get Cart
Returns the current cart without changing it.
You can use this to read cart contents before deciding what to do, or to reconcile your own state with the current cart.
getCart isn't configurable, so it returns the same shape on every storefront. cart is null when the buyer doesn't have a cart yet.
If several parts of the page ask for the cart at the same time, then they share one request rather than each making their own.
Reads the current cart. This action isn't configurable, so it returns the same cart on every storefront.
Anchor to getCart-parametersParameters
- Anchor to payloadpayloadpayloadGetCartPayloadGetCartPayload
- Anchor to optionsoptionsoptionsGetCartOptionsGetCartOptions
Anchor to getCart-returnsReturns
GetCartPayload
The payload for a `getCart` call.
- cartId
The cart GID or raw cart token. If you leave it out, the action finds the cart from the browser cookie.
string
GetCartOptions
Options for a `getCart` call.
- signal
Aborts the request when the signal fires.
AbortSignal
GetCartResult
The value a `getCart` call resolves with.
- cart
The current cart, or `null` when no cart exists yet.
CartSummary | null
CartSummary
A cart, as actions report it.
- id
The cart GID.
string - totalQuantity
The total number of items across every line.
number - cost
The cart cost.
CartCost - lines
The lines in the cart.
CartLine[] - discountCodes
The discount codes on the cart.
CartDiscountCode[]
CartCost
The cost of a cart or a cart line.
- totalAmount
The total amount.
Price
Price
An amount with its currency.
- amount
A decimal money amount, such as `29.99`.
string - currencyCode
The three-letter currency code, such as `USD`.
string
CartLine
A single line in the cart.
- id
The cart line ID.
string - quantity
The quantity for the line.
number - cost
The line cost.
CartCost
CartDiscountCode
A discount code on the cart.
- applicable
Whether the cart accepted the code.
boolean - code
The code as the buyer entered it.
string