Skip to main content
Geneva, Switzerland Call our support
English

Products, cart, and checkout

Product fields, storefront flow, and CSRF.

Product field convention

On the product content type:

Field keyTypePurpose
price_centsnumberPrice in minor units (1999 = £19.99). Required unless stripe_price_id set.
purchasablebooleanOff hides buy button while entry stays public.
stripe_price_idtextOptional Stripe Price ID (price_…) — overrides ad-hoc price_cents.
skutextOptional SKU on order line metadata.
stock_qtynumberOptional stock. Empty = unlimited. Decremented when inventory tracking enabled.

Creating a product

  1. Go to Content → Products (or your product type).
  2. Create entry with title, description, featured image.
  3. Set price_cents and purchasable on.
  4. Set stock_qty if using inventory.
  5. Publish.

Storefront

When commerce is enabled:

  • /shop — Product grid with live prices
  • Theme header shows Shop and Cart (n)
  • Product archive /{product-type-slug} shows prices and Add to cart on cards
  • Single product pages show Buy now and Add to cart when in stock

Checkout flows

ActionRouteNotes
Buy nowPOST /commerce/checkoutSingle item Stripe Checkout
View cartGET /commerce/cartUpdate quantities, apply coupon
Add to cartPOST /commerce/cart/addCSRF required
Cart checkoutPOST /commerce/cart/checkoutMulti-item Stripe Checkout
Apply couponPOST /commerce/cart/couponApply or remove code

All checkout POST routes require CSRF tokens from the storefront forms.

Success URL

/commerce/checkout/success?session_id=… triggers fulfillment (inventory, digital grants, emails, coupon redemption) if the webhook has not already processed the payment.

Buy now vs cart

Buy now skips the session cart for impulse purchases. Cart supports multiple items, coupons, and combined tax/shipping estimates before one Checkout session.

Troubleshooting

  • CSRF error on checkout — Session expired; refresh page and retry.
  • Coupon rejected — Expired, max uses reached, or cart contains stripe_price_id-only products.
  • Out of stock at checkout — Another buyer completed purchase; refresh product page.