# 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.
