removeCouponFromCart
removeCouponFromCart is a Magento 2 GraphQL mutation in the Quote module. Remove a previously-applied coupon from the cart. The cart must contain at least one item in order to remove the coupon. It returns RemoveCouponFromCartOutput and requires an Authorization header (Bearer customer token).
Last verified: against Magento 2.4.9.
Returns
Resolver class
\Magento\QuoteGraphQl\Model\Resolver\RemoveCouponFromCart
Arguments
An input object that defines which coupon code to remove from the cart.
Example request
Auto-generated from the SDL — paste-ready against your store's /graphql endpoint. Replace the host, store code, and any required values before running.
Headers
Query
mutation {
removeCouponFromCart {
cart {
gift_message {
to
from
message
}
id
items {
not_available_message
id
uid
quantity
is_available
prices { ... }
product { ... }
errors { ... }
}
itemsV2 {
items { ... }
page_info { ... }
total_count
}
applied_coupon {
code
}
applied_coupons {
code
}
email
shipping_addresses {
available_shipping_methods { ... }
selected_shipping_method { ... }
customer_notes
items_weight
cart_items { ... }
cart_items_v2 { ... }
same_as_billing
pickup_location_code
}
billing_address {
customer_notes
}
available_payment_methods {
is_deferred
code
title
}
selected_payment_method {
code
title
purchase_order_number
}
prices {
grand_total { ... }
grand_total_excluding_tax { ... }
subtotal_including_tax { ... }
subtotal_excluding_tax { ... }
discount { ... }
subtotal_with_discount_excluding_tax { ... }
applied_taxes { ... }
discounts { ... }
}
total_quantity
is_virtual
rules {
uid
}
}
}
}Variables
{}Related in QuoteGraphQl
Other fields shipped by the same module.
addProductsToCart
Add any type of product to the cart.
Quote · returns AddProductsToCartOutput
addSimpleProductsToCart
Add one or more simple products to the specified cart. We recommend using `addProductsToCart` instead.
Quote · returns AddSimpleProductsToCartOutput
addVirtualProductsToCart
Add one or more virtual products to the specified cart. We recommend using `addProductsToCart` instead.
Quote · returns AddVirtualProductsToCartOutput
applyCouponToCart
Apply a pre-defined coupon code to the specified cart.
Quote · returns ApplyCouponToCartOutput
assignCustomerToGuestCart
phpcs:ignore Magento2.GraphQL.ValidArgumentName
Quote · returns Cart!
cart
phpcs:ignore Magento2.GraphQL.ValidArgumentName
Quote · returns Cart
Every Magento dev tool, in one hosted workspace.
Free to sign up. Nothing to install. Drafts, audits, and projects saved across every tool.