Storefront APIs
Cart
The Carts module provides the APIs to manage a user’s shopping cart. It allows you to add, update, and remove items, apply discounts and loyalty points, manage addresses, and retrieve the cart’s state before checkout. Commerce Engine carts are persistent and associated with the user (anonymous or logged-in), enabling seamless experiences across sessions or devices.
Key Features Covered:
- Explicit Cart Creation: Carts must be created before items can be added.
- Persistent Carts: Carts are tied to the user’s token/account.
- Item Management: Add, update quantity, or remove products and variants to an existing cart.
- Pricing Calculation: Automatically calculates subtotals, taxes, shipping, and grand totals.
- Discount Application: Apply coupon codes, automatic promotions, loyalty points, and store credit.
- Address Management: Set billing and shipping addresses for checkout calculation.
- User Association: Carts link to anonymous or logged-in users; retrievable via
user_id
for both.
Core Concepts
Cart API Endpoints
Common Use Cases & Flows
Previous
CheckoutThis guide walks you through the process of converting a customer's shopping cart into a placed order, including address validation, shipping checks, payment processing, and handling payment retries. It utilizes endpoints primarily from the Carts, Orders, Payments, Shipping, and Common modules.
Next