Remove Item

Use the removeItem mutation to remove any items from the cart.

Mutation

removeItem(input: RemoveCartItemInput!): Cart!

ArgumentsType
inputRemoveCartItemInput!

The removeItem mutation will always return the updated Cart object.

RemoveCartItemInput!

You can remove items from the cart at any time.

ArgumentTypeDescription
cartIdID!The id of the cart you the item belongs to
idID!The id of the item you want to remove

If no item exists with the id provided, a BAD_USER_INPUT error will be returned.

Example

mutation {
  removeItem(
    input: { cartId: "ck5r8d5b500003f5o2aif0v2b", id: "5e3293a3462051" }
  ) {
    id
    isEmpty
    abandoned
    totalItems
    totalUniqueItems
    subTotal {
      formatted
    }
  }
}
{
  "data": {
    "removeItem": {
      "id": "ck5r8d5b500003f5o2aif0v2b",
      "isEmpty": true,
      "abandoned": false,
      "totalItems": 0,
      "totalUniqueItems": 0,
      "subTotal": {
        "formatted": "$0.00"
      }
    }
  }
}