Remove items from a cart
Use the removeItemsFromCart mutation to remove items from an existing cart. To remove items, cartId
and itemId
must be specified as input parameters. cartId
is a unique identifier for the cart from which the products are to be removed and itemId represents the item/product that is to be removed.
Mutation:
mutation removeItemsFromCart($input: RemoveItemsInput!) {
removeItemsFromCart(input: $input) {
cart {
id
items {
id
product {
name
}
}
pricingTotal {
amountDueAfterTax
totalTaxAmount
}
}
}
Sample arguments
{
"input":{
"cartId": "64c8c666e7977d2ffef9d97d",
"itemIds": ["5f339a9a-ce68-4bab-931c-e6ee45035241"]
}
}
Sample output
{
"data": {
"removeItemsFromCart": {
"cart": {
"id": "6512b7ff875fe104e5fde6da",
"items": [
{
"id": "b7ec8290-d984-4608-bca6-f31191e61f05",
"product": {
"name": "Tag and Track device 1"
}
},
{
"id": "5dc0fe86-b66c-450d-bd6b-9c4a5e19e061",
"product": {
"name": "Stacked Web App (DO NOT EDIT OR CHANGE)"
}
}
],
"pricingTotal": {
"amountDueAfterTax": 474.1,
"totalTaxAmount": 34.1
}
}
}
}
}
Common errors
For information on some of the common errors related to this mutation, refer to the section on Error handling.
Was this page helpful?
Tell us more…
Help us improve our content. Responses are anonymous.
Thanks
We appreciate your feedback!