ecommerce_createADiscountV1
Create a discount for a store by specifying code, type, and value. Supports percentage, fixed, and free-shipping discounts, with optional validity period, usage limits, and minimum cart value.
Instructions
Create a discount for a store. Fixed discounts take an amount in the smallest currency unit (e.g. $10 is 1000); percentage discounts take a whole-number value between 1 and 100. Free-shipping discounts ignore value. Returns the created discount.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The discount code customers enter at checkout. | |
| name | No | A human-friendly discount name. | |
| type | Yes | The discount type. | |
| value | Yes | For percentage discounts a whole number 1-100; for fixed discounts an amount in the smallest currency unit (e.g. $10 is 1000). Ignored for free_shipping. | |
| ends_at | No | When the discount expires. A bare date runs to the end of that day in time_zone. Never expires when omitted. | |
| store_id | Yes | The ID of the store to create the discount for. | |
| starts_at | No | When the discount becomes active. A bare date (2026-11-27) anchors to time_zone. Defaults to now when omitted. | |
| time_zone | No | IANA time zone used to interpret starts_at and ends_at. | |
| allocation | No | Whether the discount applies to the cart total or to each eligible item. | |
| usage_limit | No | Maximum number of times the discount can be redeemed. | |
| min_cart_value | No | Minimum cart value in the smallest currency unit required for the discount to apply. |