Skip to content

Create Cart

About

The createCart mutation creates a new shopping cart session for a customer. Use this mutation to:

  • Initialize a new shopping cart for checkout flows
  • Generate a unique cart token for session tracking
  • Start the shopping and checkout process
  • Create guest carts without customer authentication
  • Reset or recover abandoned carts
  • Manage multiple concurrent cart sessions

This mutation returns a unique cart token that identifies the cart session. This token must be used in subsequent cart operations (add items, update, checkout).

Authentication

This query requires a valid customer authentication token in the Authorization header. Use the Customer Login API to retrieve the token.

For guest users, no authentication is required. The mutation returns a unique cart token that must be used as the Authorization header in subsequent cart operations.

Authorization: Bearer <accessToken>

Possible Returns

FieldTypeDescription
cartTokenString!Unique cart session token. Use this in all subsequent cart operations.
idString!Unique cart identifier.
messageString!Success or error message.
successBoolean!Indicates if cart creation was successful.
isGuestBoolean!Indicates whether the cart is for a guest user (true) or an authenticated customer (false).
formattedGrandTotalStringCurrent cart grand total with currency symbol.
errors[ErrorMessage!]Array of validation or processing errors if applicable.

Released under the MIT License.