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](/docs/api/storefront) to interact with a cart during a customer's session. This guide shows how to create a cart and retrieve it, update cart line items and customer information, and retrieve a checkout URL. ## Requirements - You've completed the [Getting started with the Storefront API](/docs/storefronts/headless/building-with-the-storefront-api/getting-started) guide. - You've created [products](/docs/api/admin-graphql/latest/objects/product) and [product variants](/docs/api/admin-graphql/latest/objects/productvariant) in your store. - You're using version 2022-10 or higher of the Storefront API. To [set metafields on a cart](#step-4-set-metafields-on-a-cart), you need to use version 2023-04 or higher of the Storefront API. ## Cart object relationships Before you start building a cart, we recommend familiarizing yourself with the following API objects and their relationships:
A diagram showing the cart object and its relationships
| Object | Description | |---|---| | [Cart](/docs/api/storefront/latest/objects/Cart) | An object that contains the merchandise that a customer intends to purchase. | | [CartBuyerIdentity](/docs/api/storefront/latest/objects/CartBuyerIdentity) | Identifies the customer that is interacting with the cart. It includes a customer access token that associates the customer with the cart, and a set of preferences that can be used to prefill a checkout session. | | [Cost](/docs/api/storefront/latest/objects/CartCost) | The estimated costs that the customer will pay at checkout. The costs are subject to change and changes display at checkout.

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: