Skip to content

cartCreate

Mutationin Cart

Create an empty cart. Adding a line item creates one implicitly where none exists, so this is for a storefront that would rather the cart existed before the first product goes into it.

Returns

CartCreateResponse!

FieldTypeDescription
cartCartThe cart that was created
cartErrors[CartCreateError!]Error details if the cart could not be created

Example

mutation CartCreate {
cartCreate {
cart {
id
version
createdAt
lastModifiedAt
currency
customerEmail
isGuest
totalQuantity
deliveryRemarks
vatNumber
purchaseOrderNumber
deliverySplit
requestedDeliveryDate
earliestCompleteDeliveryDate
name
defaultName
status
}
cartErrors {
__typename
... on ValidationError {
message
}
... on CartError {
message
code
}
}
}
}

The query selects the return type's fields two levels deep; pick the ones you need. The response shows its shape with placeholder values.

Served by

@evolve-framework/commercetoolsResolved
@evolve-framework/medusaResolved
@evolve-framework/sfccResolved