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
| Field | Type | Description |
|---|---|---|
cartToken | String! | Unique cart session token. Use this in all subsequent cart operations. |
id | String! | Unique cart identifier. |
message | String! | Success or error message. |
success | Boolean! | Indicates if cart creation was successful. |
isGuest | Boolean! | Indicates whether the cart is for a guest user (true) or an authenticated customer (false). |
formattedGrandTotal | String | Current cart grand total with currency symbol. |
errors | [ErrorMessage!] | Array of validation or processing errors if applicable. |

