Apply Coupon
About
The applyCoupon mutation applies a promotional coupon code to a shopping cart. Use this mutation to:
- Apply discount codes to reduce cart total
- Enable promo/coupon code functionality
- Implement "Apply Coupon" features on cart page
- Validate coupon eligibility
- Display discount calculations
- Support promotional campaigns
This mutation validates coupon code, checks eligibility conditions, and recalculates cart totals with applied discount.
Authentication
This mutation supports both authenticated customers and guest users:
- Authenticated customers: Provide a valid customer authentication token in the
Authorizationheader. Obtain this token via the Customer Login API. - Guest users: Provide the Guest Cart Token
cartTokenobtained from the Create Cart mutation.
Authorization: Bearer <accessToken>Arguments
| Argument | Type | Description |
|---|---|---|
couponCode | String! | Promotional coupon code to apply. |
Possible Returns
| Field | Type | Description |
|---|---|---|
applyCoupon | Coupon! | Return coupon and cart related values. |
applyCoupon.id | String | id of the cart. |
applyCoupon.discountAmount | Float | Total discount from all applied coupons. |
applyCoupon.grandTotal | Float! | Recalculated cart total with discount. |
errors | [ErrorMessage!] | Validation errors if application failed. |

