Decrement Item Quantity

Use the decrementItemQuantity mutation to increment only the cart item quantity.

Mutation

decrementItemQuantity(input: UpdateItemQuantityInput!): Cart!

ArgumentsType
inputUpdateItemQuantityInput!

The decrementItemQuantity mutation will always return the updated Cart object.

UpdateItemQuantityInput!

ArgumentTypeDescription
cartIdID!The id of the cart you are working with.
idID!The id of the item you are decrementing the quantity of.
byInt!The amount you wish to decrement the cart item quantity by.

If no cart item exists with the id provided, an error will be returned.

Example

mutation {
  decrementItemQuantity(
    input: { cartId: "ck5r8d5b500003f5o2aif0v2b", id: "5e3293a3462051", by: 10 }
  ) {
    id
    items {
      id
      quantity
    }
  }
}
{
  "data": {
    "decrementItemQuantity": {
      "id": "ck5r8d5b500003f5o2aif0v2b",
      "items": [
        {
          "id": "ck5r8d5b500003f5o2aif0v2b",
          "quantity": 1
        }
      ]
    }
  }
}