Cart lifecycle overview
1
Start an ordering session
Creates a cart and returns a
cartId you use for all subsequent operations.2
Add items
Add products with quantities and modifier selections.
3
Update items
Change quantities or remove individual items.
4
Apply discounts
Optionally apply a promo code.
5
Proceed to checkout
Set customer details, fulfillment method, and payment.
Start an ordering session
Add an item
Add an item with modifiers
Modifiers represent customizations (e.g., size, toppings, extras). Pass them in theselections array.
Item unavailable actions
When an item becomes unavailable after being added (e.g., sold out), Crave handles it based on theitemUnavailableAction field:
Get the cart
Update item quantity
0 to remove the item.
Apply a discount
Remove a discount
Get recommended products
Show upsell suggestions based on the current cart contents.Delete the cart
Cart data model
TheStorefrontCart type includes these key fields:
Next steps
Checkout Flow
Collect customer details and process payments.
Fulfillment Methods
Configure delivery, table-side, and room service.