Edit in GitHubLog an issue
Adobe Commerce only. 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 © 2024 Adobe. All rights reserved.