removeItemFromCart
Removes an item from a cart by its CartItem.id.
This is the general-purpose removal mutation: it accepts the ID of any cart item for which
CartItem.canBeRemoved is true, no matter how that item got into the cart. What it removes depends on
the kind of item:
- A ticket type that is not placed on a seatmap: every item of that ticket type is removed and the
cart is repriced.
setCartItemQuantitywith a quantity of 0 leaves the cart in the same state, but it needs a shop to sell in and this mutation does not, so it is the only one of the two that works on every cart. - A seat of a seatmap (
SeatmapSeat): only the ticket for that seat is removed, with the same seat optimization behavior described onremoveSeatFromCart. - A general admission area of a seatmap (
SeatmapVolume): every ticket of that item's ticket type in that area is removed. Tickets of other ticket types in the same area stay. - The credit line of a redeemed discount code: the code is removed from
Cart.appliedCodes, the same as callingremoveDiscountCodeFromCart.
Any ID that does not name one of those fails with an error and leaves the cart alone. That includes
items the customer did not add, such as fees and automatically granted free items, which report
CartItem.canBeRemoved as false. An unknown cart ID or a cart that has already expired also fails.
Removing a ticket type has two failure modes of its own, each naming itself in extensions.code:
- ItemRemovalTimeout — the removal did not report back in time. It carries on, so the items may come off the cart a moment later; read the cart again rather than retrying blindly.
- UnexpectedItemRemovalError — the removal failed for a reason that has no code of its own. Nothing can be said about the cart afterwards; read it again to find out.
Cart item IDs are not stable over time (see CartItem.id), so always read the ID from a fresh
Cart.items or Cart.itemGroups response immediately before removing.
To reduce a quantity instead of clearing it out completely, use setCartItemQuantity or
setCartVolumeQuantities. To remove one specific seat without looking up its cart item ID, use
removeSeatFromCart.
Arguments
Type
This field resolves to RemoveItemFromCartResult!.