🛒 Checkout
Add Discount to Cart
Enhance your cart by applying coupon codes to specific bags
Overview
The cartApplyCoupons mutation allows you to apply coupon codes to specific bags within a cart. The mutation returns the updated Cart with the applied coupons.
mutation CartApplyCoupons($id: ID!, $input: CartApplyCouponsInput!) {
cartApplyCoupons(id: $id, input: $input) {
id
# Other fields of the Cart type can be queried here
}
}
Input Parameters
id
: The unique identifier of the cart to which you want to apply the coupons.input
: An object containing the details of the bags and the coupon codes you want to apply.
CartApplyCouponsInput
bags
: An array ofCartApplyCouponInput
objects, each representing a bag and the coupon codes to be applied to it.
CartApplyCouponInput
bagId
: The unique identifier of the bag.couponCodes
: An array of coupon codes to be applied to the specified bag.
Example
{
"id": "cart_ZMe6Bb4GqqUe3BWV",
"input": {
"bags": [
{
"bagId": "bag_ZOX6W0BvVdghMRZP",
"couponCodes": ["COUPON10", "FREESHIP"]
},
{
"bagId": "bag_ZOX6aEBvVdghMRZT",
"couponCodes": ["NEWUSER5"]
}
]
}
}
In this example, the coupon codes COUPON10
and FREESHIP
are applied to the bag with ID bag_ZOX6W0BvVdghMRZP
, and the coupon code NEWUSER5
is applied to the bag with ID bag_ZOX6aEBvVdghMRZT
.