Docs
Dashboard

Cart

Object

Represents a cart in Thor, encapsulating all information required to display and manage items across storefronts and sales channels. Each cart includes details such as the total price, line items, shipping address, and available shipping methods. Carts can be used to track items before purchase, allowing customers to review and modify their selections.

#

Fields


availableShippingMethods
[CartAvailableShippingMethod!]!

List of available shipping methods for this cart.

billingAddress
CartAddress

Gets the billing address associated with the cart. This may be the same as the shipping address.

checkoutUrl
URI!

The URL of the checkout page for the cart.

currency
String!

Gets the currency of the cart.

customerEmail
String

Gets the customer email associated with the cart, if any.

customerId
ID

Gets the customer ID associated with the cart, if any.

discountApplications
DiscountApplicationConnection!

Retrieves a paginated list of discount applications for the order

discountCodes
[DiscountCode!]!

Gets the discount codes applied to the cart.

id
ID!

The unique identifier of the cart

lineItems
CartLineItemConnection!

Retrieves a paginated list of line items for a specific cart.

lineItemsQuantity
Long!

Sum of all LineItem quantities.

marketingConsent
Boolean

Gets whether marketing consent was set on the cart, if any.

metadata
[MetadataItem!]!

Gets the metadata associated with the cart. Once the cart is ordered, this metadata is transferred to the order.

paymentSession
PaymentSession

Gets the payment session associated with the cart, if any.

priceChannel
Channel

Gets the price channel associated with the cart.

shippingAddress
CartAddress

Gets the shipping address associated with the cart.

shippingCountries
[CountryInfo!]!

List of countries this cart can be shipped to, based on the shipping methods available for the cart context. Each country includes only the zones (states/provinces) actually covered by a shipping zone. Installed apps that provide external shipping methods can extend this list with countries they deliver to, so a country may appear here without a matching shipping zone configured in the store.

shippingLines
[CartShippingLine!]!

Gets the shipping lines applied to the cart.

state
CartState!

Gets the current state of the cart.

Possible enum values
  • ACTIVE

    The default state where a Cart can be updated and ordered.

  • ORDERED

    A Cart was ordered, and no further operations are allowed on the Cart.

store
Store

Gets the store associated with the cart.

subtotal
Money!

Gets the total price of the cart before discounts and taxes.

taxedPrice
TaxedPrice

Gets the taxed price of the cart. This may be null if the cart does not yet have a taxed price.

total
Money!

Gets the total price of the cart after discounts and taxes.

#

Queries


Retrieves a cart by its ID.

#

Mutations


Creates a new cart using the provided currency.

Adds custom line items to an existing cart.

Applies a discount code to an existing cart using the given discount code.

Removes a discount code from an existing cart using the given discount code.

Adds a new line item to an existing cart. This is safe to call concurrently.

Removes line items from an existing cart. This is safe to call concurrently.

Updates one or more line items in an existing cart.

Initializes a new payment session for the specified cart and payment gateway. The payment session is valid for the duration “validUntil” as long as the cart total does not change. If the cart total changes, a new payment session must be initialized.

Replicates an existing cart. This is useful for creating a new cart based on an existing one, such if the user want to swap to another channel or currency.

Adds a shipping line to the cart using a shipping method ID.

Removes a shipping line from the cart using a shipping line ID.

Sets the shipping lines on the cart using the provided shipping method IDs. Existing shipping lines are replaced with the new selection.

Updates an existing cart. This is safe to call concurrently.