You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add live stock counter (X/25 remaining + sold-out)
Worker:
- New GET /stock endpoint returns remaining count per edition from a
STOCK KV namespace (EDITION_SIZE - sold), with GET CORS.
- Checkout writes a machine-readable metadata.skus list (key:qty).
- Webhook decrements KV per purchased edition after the order email.
- wrangler.toml gains the STOCK KV binding (id to be filled after
`wrangler kv namespace create STOCK`); README documents setup.
Frontend:
- scripts/stock.js fetches /stock once and hands counts to listeners,
failing silent if the endpoint is unreachable (no badges, no breakage).
- Shop cards show "X / 25 left" (red when <=5) and flip to "Sold out"
with a disabled Acquire button + dimmed art at zero.
- Product pages show "X of 25 remaining" and disable Acquire when sold out.
https://claude.ai/code/session_01VhWRYXbuqapZ9YkvksroaS
0 commit comments