Cart
ObjectRepresents 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
- [CartAvailableShippingMethod!]!
availableShippingMethods List of available shipping methods for this cart.
- CartAddress
billingAddress Gets the billing address associated with the cart. This may be the same as the shipping address.
- URI!
checkoutUrl The URL of the checkout page for the cart.
- String!
currency Gets the currency of the cart.
- String
customerEmail Gets the customer email associated with the cart, if any.
- ID
customerId Gets the customer ID associated with the cart, if any.
- DiscountApplicationConnection!
discountApplications Retrieves a paginated list of discount applications for the order
- [DiscountCode!]!
discountCodes Gets the discount codes applied to the cart.
- ID!
id The unique identifier of the cart
- CartLineItemConnection!
lineItems Retrieves a paginated list of line items for a specific cart.
- Long!
lineItemsQuantity Sum of all LineItem quantities.
- Boolean
marketingConsent Gets whether marketing consent was set on the cart, if any.
- [MetadataItem!]!
metadata 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.
- Channel
priceChannel Gets the price channel associated with the cart.
- CartAddress
shippingAddress Gets the shipping address associated with the cart.
- [CountryInfo!]!
shippingCountries 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.
- [CartShippingLine!]!
shippingLines Gets the shipping lines applied to the cart.
- CartState!
state Gets the current state of the cart.
Possible enum valuesACTIVEThe default state where a Cart can be updated and ordered.
ORDEREDA Cart was ordered, and no further operations are allowed on the Cart.
- Store
store Gets the store associated with the cart.
- Money!
subtotal 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.
- Money!
total 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.