removeDiscountCodeFromCart
Removes a previously applied discount code from a cart.
Pass the cart ID and the code itself, not a cart item ID. Codes are matched case-insensitively and
surrounding whitespace is ignored, so the value you originally passed to applyDiscountCode
always works, as does any entry from Cart.appliedCodes.
The code is dropped from Cart.appliedCodes and the cart is repriced: the discount's own line item
disappears from Cart.items, and Cart.grandTotal and Cart.hasDiscounts are recalculated.
Removing a code that is not currently applied is not an error. The cart simply resolves unchanged on
RemoveDiscountCodeFromCartPayload.cart. An unknown cart ID fails with an error, and so does an empty
code.
To apply a code, use applyDiscountCode, or applyCodeToNewCart when you do not have
a cart yet. Passing the discount line item's CartItem.id to removeItemFromCart has the same
effect as calling this mutation.
Arguments
| Argument | Description | Type |
|---|---|---|
| input | RemoveDiscountCodeFromCartInput! |
Type
This field resolves to RemoveDiscountCodeFromCartPayload, which has the following fields: