Generate Cart Rule Coupons
Bulk-creates several coupon codes in one call — the Generate Coupons 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 |
|---|---|---|
createAdminMarketingCartRuleCouponGenerate | Mutation | Generate multiple coupon codes |
Details
- Requires an admin Bearer token and the
marketing.promotions.cart_rules.createpermission. - Builds
couponQtycodes of the givenlength, each wrapped with the optionalprefixandsuffix. The response returns the count plus the full list of new coupons. - Generated codes are all secondary codes (
isPrimaryisfalse,typeis1).
Input fields
| Field | Type | Required | Notes |
|---|---|---|---|
cartRuleId | Int | Yes | Parent cart-rule id |
length | Int | Yes | Random part length, 4–30 |
format | String | Yes | alphabetic, alphanumeric, or numeric |
prefix | String | No | Prepended to every code |
suffix | String | No | Appended to every code |
couponQty | Int | Yes | Number of codes to generate, 1–100 |

