Frontend API
Methods to apply and remove coupon codes from the cart.
Use to apply one coupon per cart. Codes are not case-sensitive.
Returns the updated cart object if the code is valid. Otherwise, it returns a validation error.
Apply a coupon
await swell.cart.applyCoupon('SUMMERTIME')
Use to remove the coupon code from the cart, if one was applied.
Remove a coupon
await swell.cart.removeCoupon()
Methods to apply and remove coupon codes from the cart.
Apply a coupon
Use to apply one coupon per cart. Coupon codes are not case-sensitive. Returns the updated cart object if the discount code is valid. Otherwise, returns a validation error.
The parameters for this query are code (required), _locale, and _currency.
Apply a coupon
mutation {
applyCoupon(code: "SAVE10") {
accountId
grandTotal
couponId
couponCode
}
}Remove a coupon
Use to remove a coupon from an account order. Returns the updated cart object.
The parameters for this mutation are _locale, and _currency.
Remove a coupon
mutation {
removeCoupon {
accountId
grandTotal
couponId
couponCode
}
}