RECORDGOD/wp-bridge/README.md
type-two 5ad4de1d2c feat(bridge): RecordGod WP bridge plugin (WowPlatter successor) + thumb on browse/release
Thin WordPress/Woo bridge — RecordGod owns catalog/stock/pricing/shipping; the plugin is a storefront
skin + checkout adapter over /shop:
- storefront: SSR /records (browse) + /release/{id} inside the theme, with title/meta/JSON-LD MusicAlbum
- on-the-fly Woo product: /?rg_add=<sku> mints a hidden WC_Product_Simple from /shop/item (the WowPlatter
  trick — 25k catalog, only sold items become Woo products)
- shipping: WC_Shipping_Method quoting /shop/shipping/quote by cart item count (AusPost flat rate)
- orders: order_status_completed -> POST /shop/woo-order (X-Bridge-Key), idempotent, marks SKUs sold
- settings page: base URL + bridge key + store id
Backend: added thumb to /shop/browse + /shop/release so storefront pages have cover art.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 01:43:30 +10:00

27 lines
1.9 KiB
Markdown

# RecordGod Bridge (WordPress plugin)
Thin successor to WowPlatter. **RecordGod owns the catalog, stock, pricing and shipping**; this plugin is a
storefront skin + checkout adapter over its `/shop` API. WordPress/WooCommerce is kept lean — Woo only ever
sees the records people actually buy.
## What it does
| Concern | How |
|---|---|
| **Storefront (SEO)** | `class-rg-storefront.php` — server-renders `/records` (browse) and `/release/{id}` inside the theme, with `<title>`, meta description, and JSON-LD `MusicAlbum`/`Offer`. Pulls `/shop/browse` + `/shop/release`. |
| **On-the-fly Woo product** | `class-rg-cart.php` — the WowPlatter trick. `/?rg_add=<sku>` looks the SKU up (`wc_get_product_id_by_sku`); if absent, mints a hidden `WC_Product_Simple` from `/shop/item` (price, image, stock=1) then adds it to the cart. 25k catalog, ~handful of Woo products. |
| **Shipping** | `class-rg-shipping.php` — a `WC_Shipping_Method` that quotes postage from `/shop/shipping/quote?units=<cart item count>` (AusPost Parcel/Express flat rate, 280g/record). Add it to a Woo shipping zone. |
| **Order webhook** | `class-rg-orders.php` — on `order_status_completed`, POSTs the order back to `/shop/woo-order` (with `X-Bridge-Key`). RecordGod marks the SKUs sold + logs the online sale. Idempotent. |
| **Settings** | Settings → RecordGod Bridge: base URL, bridge key (must match RecordGod's `bridge_key` secret), store id. |
## Install
1. Copy `wp-bridge/` to `wp-content/plugins/recordgod-bridge/` and activate (flushes rewrite rules).
2. Settings → RecordGod Bridge: set base URL (`https://recordgod.com`) + bridge key.
3. WooCommerce → Settings → Shipping → add **RecordGod Postage** to your AU zone.
4. Visit `/records`. (If pages 404, re-save Permalinks once.)
## Not in scope (stays where it is)
- Woo handles payment + transactional emails.
- RecordGod sends its own receipts (`mailer.py`) and holds Discogs/import auth — no OAuth in this plugin.