Create Cart Rule
Creates a cart rule — the Create Cart Rule action on the admin Marketing → Promotions → Cart Rules screen. A cart rule discounts the cart at checkout, optionally gated behind a coupon code.
TIP
New here? Read the Cart Rules overview for what a cart rule does and how its fields behave.
Operation
| Operation | Type | Purpose |
|---|---|---|
createAdminMarketingCartRule | Mutation | Create a cart rule |
Details
- Requires an admin Bearer token and the
marketing.promotions.cart_rules.createpermission. - When
couponTypeis1anduseAutoGenerationis0, a uniquecouponCodeis required — it becomes the rule's single primary coupon. Bulk codes are managed through the Cart Rule Coupons sub-resource. - The mutation returns the full rule payload, including the resolved
conditions,channels, andcustomerGroups.
Input fields
| Field | Type | Required | Notes |
|---|---|---|---|
name | String | Yes | Rule name |
description | String | No | Free-text description |
channels | Array | Yes | Non-empty list of channel ids |
customerGroups | Array | Yes | Non-empty list of customer-group ids |
couponType | Int | No | 0 no coupon (auto-applies) / 1 specific coupon |
useAutoGeneration | Int | No | 1 to auto-generate coupon codes |
couponCode | String | No | Required + unique when couponType is 1 and useAutoGeneration is 0 |
actionType | String | Yes | by_percent, by_fixed, cart_fixed, buy_x_get_y |
discountAmount | Float | Yes | Discount value; capped at 100 when actionType is by_percent |
discountQuantity | Int | No | Quantity for buy_x_get_y |
discountStep | String | No | Buy-step for buy_x_get_y |
applyToShipping | Int | No | 1 applies the discount to shipping too |
freeShipping | Int | No | 1 grants free shipping |
conditionType | Int | No | 1 match all conditions / 0 match any |
conditions | Array | No | Cart / product condition filters |
endOtherRules | Int | No | 1 stops lower-priority rules from also applying |
usesAttributeConditions | Int | No | 1 when conditions use product attributes |
usagePerCustomer | Int | No | Per-customer usage limit (0 = unlimited) |
usesPerCoupon | Int | No | Per-coupon usage limit (0 = unlimited) |
sortOrder | Int | No | Priority — lower runs first |
status | Int | No | 0 inactive / 1 active |
startsFrom | String | No | Start date (ISO 8601) or null |
endsTill | String | No | End date (ISO 8601) or null; must be >= startsFrom |

