Create promotion
create_promotionCreate percentage or fixed-amount discount codes and automatic promotions in Medusa for orders, products, or shipping, including free shipping and category restrictions.
Instructions
Creates a discount code (or an automatic promotion): percentage or fixed amount off the order, specific products, or shipping. Free shipping = applies_to 'shipping', percentage 100. Restricting to products/categories/collections makes it apply to those items only. Plain dates are interpreted in the reporting timezone.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The code customers enter, e.g. AUTUMN20 | |
| value | Yes | Percent (20 = 20 %) or amount in major units | |
| status | No | active | |
| ends_at | No | Inclusive, e.g. 2026-11-30 | |
| starts_at | No | E.g. 2026-11-01 | |
| allocation | No | 'across' (default) splits the discount over the eligible items; 'each' applies it to every unit up to max_quantity | |
| applies_to | No | Defaults to 'items' when restricted to products/categories/collections, otherwise 'order' | |
| extra_rules | No | Advanced eligibility conditions | |
| product_ids | No | ||
| usage_limit | No | Total number of uses (not for automatic promotions) | |
| category_ids | No | ||
| is_automatic | No | Applies without entering the code | |
| max_quantity | No | Required with allocation 'each' | |
| currency_code | No | Required for a fixed amount, e.g. czk | |
| discount_type | Yes | ||
| collection_ids | No | ||
| customer_group_ids | No | Only for customers in these groups |