Create discount
create_discountCreate a discount code for percentage, fixed-amount, or free-shipping offers, with optional limits on minimum subtotal, total uses, and validity dates.
Instructions
Create a discount code. type is 'percentage' (value 0-100), 'fixed' (value in minor currency units, requires currency e.g. 'USD'; it applies only to carts in that currency), or 'free_shipping' (value 0). Optional limits: minSubtotal, maxUses, startsAt, endsAt. A cart is in its sales channel's currency; for a 'percentage' or 'free_shipping' code with a minimum, minSubtotal is the default-currency minimum and minSubtotalByCurrency the minimum in each additional currency.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>",
"type": "<type>",
"value": "<value>"
},
"name": "create_discount"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The discount code | |
| type | Yes | ||
| value | Yes | Percent (0-100), fixed amount in minor units, or 0 | |
| endsAt | No | ISO date-time the code expires | |
| enabled | No | ||
| maxUses | No | Total redemption cap | |
| currency | No | ISO 4217 code, required for 'fixed' type, omit otherwise | |
| startsAt | No | ISO date-time the code becomes valid | |
| minSubtotal | No | Minimum cart subtotal in minor units: of the code's own currency for 'fixed', of the default currency otherwise. With minSubtotalByCurrency set, omitting it means the code does not apply to default-currency carts, and 0 means it applies to them with no minimum | |
| minSubtotalByCurrency | No | 'percentage' and 'free_shipping' only: minimum subtotal for carts in each additional currency, e.g. [{currency: 'EUR', amount: 5000}]. A code with any minimum applies only in the currencies its minimums name - nothing is converted |