Skip to content

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

OperationTypePurpose
createAdminMarketingCartRuleCouponGenerateMutationGenerate multiple coupon codes

Details

  • Requires an admin Bearer token and the marketing.promotions.cart_rules.create permission.
  • Builds couponQty codes of the given length, each wrapped with the optional prefix and suffix. The response returns the count plus the full list of new coupons.
  • Generated codes are all secondary codes (isPrimary is false, type is 1).

Input fields

FieldTypeRequiredNotes
cartRuleIdIntYesParent cart-rule id
lengthIntYesRandom part length, 430
formatStringYesalphabetic, alphanumeric, or numeric
prefixStringNoPrepended to every code
suffixStringNoAppended to every code
couponQtyIntYesNumber of codes to generate, 1100

Released under the MIT License.