Edit in GitHubLog an issue
Adobe Commerce featureExclusive feature only in Adobe Commerce (Learn more)

clearCart mutation

The clearCart mutation removes all items from the specified cart.

Syntax

Copied to your clipboard
mutation {
clearCart(input: ClearCartInput) {
ClearCartOutput
}
}

Reference

The clearCart reference provides detailed information about the types and fields defined in this mutation.

Example usage

Request:

Copied to your clipboard
mutation {
clearCart(input: {uid: "B79Qefk7pUaxahYtO8WjOtr5UyEyjaYV"}) {
cart {
id
itemsV2 {
items {
uid
}
}
}
errors {
message
}
}
}

Response:

The response is the cart with no items.

Copied to your clipboard
{
"data": {
"clearCart": {
"cart": {
"id": "B79Qefk7pUaxahYtO8WjOtr5UyEyjaYV",
"itemsV2": {
"items": []
}
},
"errors": null
}
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.