Cart
The Cart menu is the shopping cart — creating a cart, adding and updating items, applying coupons, and reading the current cart with its totals. It is the first half of the buying flow; once the cart is ready you move on to Checkout.
How the cart token works
Creating a cart returns a cart token. That token identifies the cart on every subsequent cart operation, so a guest can build up a cart without being signed in. A signed-in customer can also keep a cart; the merge mutation combines a guest cart into the customer's cart after they log in, so nothing is lost.
Typical sequence
- Create a cart (returns the cart token).
- Add items (and update or remove them as the shopper changes their mind).
- Optionally apply a coupon, and remove it again if needed.
- Read the cart at any point to show the current items and totals.
Operations in this menu
| Operation | GraphQL field |
|---|---|
| Get Cart | createReadCart mutation |
| CreateCart | createCart mutation |
| AddToCart | addItemToCart mutation |
| UpdateCartItem | updateItemToCart mutation |
| RemoveCartItem | removeCartItem mutation |
| Merge Cart | mergeCart mutation |
| ApplyCoupon | applyCoupon mutation |
| RemoveCoupon | removeCoupon mutation |
Cart operations are keyed by the cart token; a guest needs only the storefront key, while a signed-in customer also sends their Bearer token. See Authentication.

