The Cart page shows all the items in the cart. Buyers can change the number of items or remove items, calculate the total amount of items in the cart, and add items to the cart to continue shopping.
Each buyer action on this page links to a specific Salesforce Commerce Cart REST API operation. This keeps the cart state in sync between the storefront and the commerce backend.
This flow demonstrates how a headless storefront can render cart experiences, including cart item management, pricing, and checkout actions, using B2B Commerce Cart APIs.
The productFields=\* parameter is required to hydrate product information for each cart line item. Without this parameter, the response includes only product IDs and pricing data.
Use the response to render:
Cart line items
Product names
Product SKUs
Pricing information
Promotions
Applied coupons
Cart totals
Store both the cartSummary and cart item collection in client-side state so other storefront surfaces, such as the cart badge and checkout summary, can reuse the data without additional API requests.
Update Item Quantity
Change the quantity using the line-item quantity selector.
Call the following endpoint to update the cart item quantity: