A cart contains the merchandise that a customer intends to purchase, and the estimated cost associated with the cart. You can use the Storefront API to interact with a cart during a customer's session.
This guide introduces how a cart works, and some considerations before you get started.
How a cart worksAnchor link to section titled "How a cart works"
Customers add items to their cart that they intend to purchase. When a customer is ready to purchase their items, they can proceed to checkout.
The cart object includes the following relationships:
|Cart||An object that contains the merchandise that a customer intends to purchase.|
|BuyerIdentity||Identifies the customer that is interacting with the cart. It includes a customer access token that associates the customer with the cart.|
|EstimatedCost||The estimated total cost of all merchandise that the customer will pay at checkout. Estimated costs are subject to change and changes are reflected at checkout.|
|Attribute||An array of custom information for a cart line. Attributes are returned as key-value pairs.|
|CartLine||A list of line item objects, each containing information about an item in the cart.|
|Merchandise||A product variant. It represents one version of a product with several options.|
International pricingAnchor link to section titled "International pricing"
Merchants can configure the prices of products on a per country basis in their Shopify admin. The prices that display on a storefront are determined in the following ways:
- Checkout pricing: The final sale price.
BuyerIdentityis used to determine international pricing and should match the customer's shipping address.
- Cart pricing: The estimated final sale price.
BuyerIdentityto determine international pricing.
- Product queries: The price that displays on a product page. Products use the
@inContextdirective to determine international pricing.
ConsiderationsAnchor link to section titled "Considerations"
- The cart is subject to the same throttling restrictions as the Storefront API.
- The cart supports a maximum of 500 line items.
- A shop or customer can create an unlimited number of carts.
- Unused and abandoned carts automatically expire within ten days of creation.
- Shopify automatically deletes the cart when the customer completes their checkout.
- Shopify Plus bot protection is available for cart.
- Learn how to manage a cart in Shopify with the Storefront API.