Skip to content

cartDelete

Mutationin Multiple carts

Delete a cart. Deleting the current one promotes another, and the response says which is current afterwards.

Arguments

ArgumentTypeDescription
idID!
versionString

Returns

CartDeleteResponse!

FieldTypeDescription
currentCartCartThe cart that is current now the delete has happened. Deleting the current cart promotes another one, and this says which, so a client is never left pointing at a deleted cart nor has to refetch to find out where it is. Null when the caller has no cart left.
cartErrors[CartDeleteError!]Error details if the cart could not be deleted

Example

mutation CartDelete($id: ID!, $version: String) {
cartDelete(id: $id, version: $version) {
currentCart {
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

Used by

The storefront packages that send it, in these GraphQL documents: