Create Cart Rule Coupon
Adds a single coupon code to a cart rule — the Add Coupon action on the admin Marketing → Promotions → Cart Rules → Coupons screen.
TIP
New here? Read the Cart Rule Coupons overview for what a coupon does and how its fields behave.
Operation
| Operation | Type | Purpose |
|---|---|---|
createAdminMarketingCartRuleCoupon | Mutation | Add one coupon code to a cart rule |
Details
- Requires an admin Bearer token and the
marketing.promotions.cart_rules.createpermission. codemust be unique across all cart-rule coupons.- Omitted
usageLimit/usagePerCustomer/expiredAtinherit the parent rule's values. - The created coupon is always a secondary code:
isPrimaryisfalseandtypeis1. The rule's primary code is managed on the cart rule itself. - To create many codes at once, use the generate mutation instead.
Input fields
| Field | Type | Required | Notes |
|---|---|---|---|
cartRuleId | Int | Yes | Parent cart-rule id |
code | String | Yes | Coupon code — must be unique |
usageLimit | Int | No | Total redemptions allowed; inherits the rule when omitted |
usagePerCustomer | Int | No | Redemptions per customer; inherits the rule when omitted |
expiredAt | String | No | Expiry date (YYYY-MM-DD); inherits the rule when omitted |

