Search Documentation
Search for a documentation page...
Cart
Manage shopping carts — add items, update quantities, and initiate checkout.
Create or Update a Cart
The cartUpsert method creates a new cart or updates an existing one:
Parameters
| Parameter | Type | Description |
|---|---|---|
cartId | string | Existing cart ID (omit to create new) |
items | array | Items to add or update |
items[].variantId | string | The variant to add |
items[].quantity | number | Quantity to set |
Get a Cart
Fetch an existing cart by ID:
Response
Remove an Item
Remove a specific item from the cart:
Checkout
The cart includes a checkoutUrl that redirects to Stripe Checkout. In the storefront, this is used in the cart sidebar:
Stripe handles the payment flow and redirects back to your store's success page on completion.
Cart in the Storefront
The storefront template manages cart state with a combination of React Context and Server Actions: