create_price_rule
Create a discount rule to define promotional offers on your store, including discount type, value, target items, and customer eligibility.
Instructions
Create a new price rule (discount rule). Side effect: creates a PriceRule record. value must be a STRING (e.g. "-10.0" for 10% off). title, value_type, value, target_type, allocation_method, customer_selection, target_selection are required.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Price rule display title. Required. | |
| value | Yes | Discount value as string — negative for discount (e.g. "-10.0" = 10% off). Required. | |
| ends_on | No | End date (ISO 8601). null = no expiry. | |
| starts_on | No | Start date (ISO 8601). If omitted, rule is immediately active. | |
| value_type | Yes | Type of discount: percentage, fixed_amount, or shipping. Required. | |
| target_type | Yes | What the discount applies to. Required. | |
| usage_limit | No | Max total uses. null = unlimited. | |
| target_selection | Yes | Which items are targeted: all or entitled only. Required. | |
| allocation_method | Yes | How discount is allocated across items. Required. | |
| once_per_customer | No | Limit to one use per customer. | |
| customer_selection | Yes | Which customers qualify: all or those meeting prerequisites. Required. |