Skip to content

Update Cart Item

About

The updateCartItem mutation modifies the quantity or options of an existing cart item. Use this mutation to:

  • Update product quantities in the shopping cart
  • Adjust cart items from the cart page
  • Modify product options or variants after adding
  • Handle quantity increase/decrease operations
  • Validate inventory availability for new quantities
  • Recalculate cart totals and discounts

This mutation validates the new quantity against available inventory and updates cart totals including any applicable discounts and taxes.

Items whose quantity cannot change

Event and appointment booking products reject a quantity update once they are in the cart. Their quantity is fixed by the booking itself — an event booking's ticket counts are set at add-to-cart time, and an appointment booking is always a single slot.

Read canChangeQty on the cart item to tell the two apart: it is false for these products. Changing the amount then means removing the item and adding it again with the new configuration, which is what the storefront does.

Arguments

ArgumentTypeDescription
cartItemIdInt!The numeric ID of the cart item to update.
quantityInt!The new quantity to set for the cart item.

Take cartItemId from the id field on a cart item — Add to Cart and Get Cart both return it at items.edges[].node.id.

Authentication

This mutation supports both authenticated customers and guest users:

  • Authenticated customers: Provide a valid customer authentication token in the Authorization header. Obtain this token via the Customer Login API.
  • Guest users: Provide the Guest Cart Token cartToken obtained from the Create Cart mutation.
Authorization: Bearer <accessToken>

Possible Returns

FieldTypeDescription
createUpdateCartItemCart!Updated cart with modified item.
updateCartItemCartItem!The updated cart.
messageString!Success or error message.
successBoolean!Indicates successful update.
errors[ErrorMessage!]Validation errors if quantity unavailable.

Released under the MIT License.