Cart
A cart represents the merchandise that a buyer intends to purchase, and the estimated cost associated with the cart. Learn how to interact with a cart during a customer's session.
Anchor to Fields and connectionsFields and connections
- Anchor to appliedGiftCardsapplied•[Applied
Gift Cards Gift Card!]! non-null The gift cards that have been applied to the cart.
- Anchor to attributeattribute•Attribute
An attribute associated with the cart.
- Anchor to attributesattributes•[Attribute!]!non-null
The attributes associated with the cart. Attributes are represented as key-value pairs.
- Anchor to buyerIdentitybuyer•Cart
Identity Buyer Identity! non-null Information about the buyer that's interacting with the cart.
- Anchor to checkoutUrlcheckout•URL!
Url non-null The URL of the checkout for the cart.
- Anchor to costcost•Cart
Cost! non-null The estimated costs that the buyer will pay at checkout. The costs are subject to change and changes will be reflected at checkout. The
cost
field uses thefield to determine international pricing.
- Anchor to createdAtcreated•Date
At Time! non-null The date and time when the cart was created.
- Anchor to deliveryGroupsdelivery•Cart
Groups Delivery Group Connection! non-null The delivery groups available for the cart, based on the buyer identity default delivery address preference or the default address of the logged-in customer.
- Anchor to discountAllocationsdiscount•[Cart
Allocations Discount Allocation!]! non-null The discounts that have been applied to the entire cart.
- Anchor to discountCodesdiscount•[Cart
Codes Discount Code!]! non-null The case-insensitive discount codes that the customer added at checkout.
- •ID!non-null
A globally-unique ID.
- Anchor to lineslines•Base
Cart Line Connection! non-null A list of lines containing information about the items the customer intends to purchase.
- Anchor to metafieldmetafield•Metafield
A custom field, including its
namespace
andkey
, that's associated with a Shopify resource for the purposes of adding and storing additional information.- Anchor to metafieldsmetafields•[Metafield]!non-null
A list of custom fields that a merchant associates with a Shopify resource.
- Anchor to notenote•String
A note that's associated with the cart. For example, the note can be a personalized message to the buyer.
- Anchor to totalQuantitytotal•Int!
Quantity non-null The total number of items in the cart.
- Anchor to updatedAtupdated•Date
At Time! non-null The date and time when the cart was updated.
- Anchor to estimatedCostestimated•Cart
Cost Estimated Cost! non-nullDeprecated
Anchor to QueriesQueries
- •query
Retrieve a cart by its ID. For more information, refer to Manage a cart with the Storefront API.
Anchor to MutationsMutations
- •mutation
Updates the attributes on a cart.
- Anchor to attributesattributes•[Attribute
Input!]! required An array of key-value pairs that contains additional information about the cart.
The input must not contain more than
250
values.- Anchor to cartIdcart•ID!
Id required The ID of the cart.
Arguments
- Anchor to cartcart•Cart
The updated cart.
- Anchor to userErrorsuser•[Cart
Errors User Error!]! non-null The list of errors that occurred from executing the mutation.
- Anchor to warningswarnings•[Cart
Warning!]! non-null A list of warnings that occurred during the mutation.
Fields
- •mutation
Updates customer information associated with a cart. Buyer identity is used to determine international pricing and should match the customer's shipping address.
- Anchor to buyerIdentitybuyer•Cart
Identity Buyer Identity Input! required The customer associated with the cart. Used to determine international pricing. Buyer identity should match the customer's shipping address.
- Anchor to cartIdcart•ID!
Id required The ID of the cart.
Arguments
- Anchor to cartcart•Cart
The updated cart.
- Anchor to userErrorsuser•[Cart
Errors User Error!]! non-null The list of errors that occurred from executing the mutation.
- Anchor to warningswarnings•[Cart
Warning!]! non-null A list of warnings that occurred during the mutation.
Fields
- •mutation
Creates a new cart.
- Anchor to inputinput•Cart
Input The fields used to create a cart.
Arguments
- Anchor to cartcart•Cart
The new cart.
- Anchor to userErrorsuser•[Cart
Errors User Error!]! non-null The list of errors that occurred from executing the mutation.
- Anchor to warningswarnings•[Cart
Warning!]! non-null A list of warnings that occurred during the mutation.
Fields
- •mutation
Updates the discount codes applied to the cart.
- Anchor to cartIdcart•ID!
Id required The ID of the cart.
- Anchor to discountCodesdiscount•[String!]
Codes The case-insensitive discount codes that the customer added at checkout.
The input must not contain more than
250
values.
Arguments
- Anchor to cartcart•Cart
The updated cart.
- Anchor to userErrorsuser•[Cart
Errors User Error!]! non-null The list of errors that occurred from executing the mutation.
- Anchor to warningswarnings•[Cart
Warning!]! non-null A list of warnings that occurred during the mutation.
Fields
- •mutation
Updates the gift card codes applied to the cart.
- Anchor to cartIdcart•ID!
Id required The ID of the cart.
- Anchor to giftCardCodesgift•[String!]!
Card Codes required The case-insensitive gift card codes.
The input must not contain more than
250
values.
Arguments
- Anchor to cartcart•Cart
The updated cart.
- Anchor to userErrorsuser•[Cart
Errors User Error!]! non-null The list of errors that occurred from executing the mutation.
- Anchor to warningswarnings•[Cart
Warning!]! non-null A list of warnings that occurred during the mutation.
Fields
- •mutation
Adds a merchandise line to the cart.
- Anchor to cartIdcart•ID!
Id required The ID of the cart.
- Anchor to lineslines•[Cart
Line Input!]! required A list of merchandise lines to add to the cart.
The input must not contain more than
250
values.
Arguments
- Anchor to cartcart•Cart
The updated cart.
- Anchor to userErrorsuser•[Cart
Errors User Error!]! non-null The list of errors that occurred from executing the mutation.
- Anchor to warningswarnings•[Cart
Warning!]! non-null A list of warnings that occurred during the mutation.
Fields
- •mutation
Removes one or more merchandise lines from the cart.
- Anchor to cartIdcart•ID!
Id required The ID of the cart.
- Anchor to lineIdsline•[ID!]!
Ids required The merchandise line IDs to remove.
The input must not contain more than
250
values.
Arguments
- Anchor to cartcart•Cart
The updated cart.
- Anchor to userErrorsuser
Errors
Fields