Skip to main content
object

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

•[AppliedGiftCard!]!
non-null

The gift cards that have been applied to the cart.

•Attribute

An attribute associated with the cart.

•[Attribute!]!
non-null

The attributes associated with the cart. Attributes are represented as key-value pairs.

•CartBuyerIdentity!
non-null

Information about the buyer that's interacting with the cart.

•URL!
non-null

The URL of the checkout for the cart.

•CartCost!
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 the buyerIdentity field to determine international pricing.

•DateTime!
non-null

The date and time when the cart was created.

•CartDeliveryGroupConnection!
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.

•[CartDiscountAllocation!]!
non-null

The discounts that have been applied to the entire cart.

•[CartDiscountCode!]!
non-null

The case-insensitive discount codes that the customer added at checkout.

•ID!
non-null

A globally-unique ID.

•BaseCartLineConnection!
non-null

A list of lines containing information about the items the customer intends to purchase.

•Metafield

A custom field, including its namespace and key, that's associated with a Shopify resource for the purposes of adding and storing additional information.

•[Metafield]!
non-null

A list of custom fields that a merchant associates with a Shopify resource.

•String

A note that's associated with the cart. For example, the note can be a personalized message to the buyer.

•Int!
non-null

The total number of items in the cart.

•DateTime!
non-null

The date and time when the cart was updated.

•CartEstimatedCost!
non-nullDeprecated

Was this section helpful?

•query

Retrieve a cart by its ID. For more information, refer to Manage a cart with the Storefront API.


Was this section helpful?

•mutation

Updates the attributes on a cart.

Arguments

•[AttributeInput!]!
required

An array of key-value pairs that contains additional information about the cart.

The input must not contain more than 250 values.

•ID!
required

The ID of the cart.


Fields

•Cart

The updated cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.

•mutation

Updates customer information associated with a cart. Buyer identity is used to determine international pricing and should match the customer's shipping address.

Arguments

•CartBuyerIdentityInput!
required

The customer associated with the cart. Used to determine international pricing. Buyer identity should match the customer's shipping address.

•ID!
required

The ID of the cart.


Fields

•Cart

The updated cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.

•mutation

Creates a new cart.

Arguments

•CartInput

The fields used to create a cart.


Fields

•Cart

The new cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.

•mutation

Updates the discount codes applied to the cart.

Arguments

•ID!
required

The ID of the cart.

•[String!]

The case-insensitive discount codes that the customer added at checkout.

The input must not contain more than 250 values.


Fields

•Cart

The updated cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.

•mutation

Updates the gift card codes applied to the cart.

Arguments

•ID!
required

The ID of the cart.

•[String!]!
required

The case-insensitive gift card codes.

The input must not contain more than 250 values.


Fields

•Cart

The updated cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.

•mutation

Adds a merchandise line to the cart.

Arguments

•ID!
required

The ID of the cart.

•[CartLineInput!]!
required

A list of merchandise lines to add to the cart.

The input must not contain more than 250 values.


Fields

•Cart

The updated cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.

•mutation

Removes one or more merchandise lines from the cart.

Arguments

•ID!
required

The ID of the cart.

•[ID!]!
required

The merchandise line IDs to remove.

The input must not contain more than 250 values.


Fields

•Cart

The updated cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.

•mutation

Updates one or more merchandise lines on a cart.

Arguments

•ID!
required

The ID of the cart.

•[CartLineUpdateInput!]!
required

The merchandise lines to update.

The input must not contain more than 250 values.


Fields

•Cart

The updated cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.

•mutation

Updates the note on the cart.

Arguments

•ID!
required

The ID of the cart.

•String!
required

The note on the cart.


Fields

•Cart

The updated cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.

•mutation

Update the selected delivery options for a delivery group.

Arguments

•ID!
required

The ID of the cart.

Anchor to selectedDeliveryOptionsselectedDeliveryOptions
•[CartSelectedDeliveryOptionInput!]!
required

The selected delivery options.

The input must not contain more than 250 values.


Fields

•Cart

The updated cart.

•[CartUserError!]!
non-null

The list of errors that occurred from executing the mutation.

•[CartWarning!]!
non-null

A list of warnings that occurred during the mutation.


Was this section helpful?


Was this section helpful?