create_price_rule
Create a basic code discount in Shopify using GraphQL. Define discount type, value, eligibility, and duration.
Instructions
Create a modern basic code discount through GraphQL. Preserves the legacy price-rule tool name for compatibility.
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": {
"title": "<title>",
"target_type": "<target_type>",
"target_selection": "<target_selection>",
"allocation_method": "<allocation_method>",
"value_type": "<value_type>",
"value": "<value>",
"starts_at": "<starts_at>"
},
"name": "create_price_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Price rule title (internal name). | |
| target_type | Yes | What the discount applies to. | |
| target_selection | Yes | Which items the discount targets. | |
| allocation_method | Yes | How the discount is allocated: 'across' splits evenly, 'each' applies to each item. | |
| value_type | Yes | Type of discount value. | |
| value | Yes | Discount value (negative number, e.g. '-10.0' for 10% or $10 off). | |
| customer_selection | No | Which customers qualify. Default: all. | all |
| starts_at | Yes | When the discount becomes active (ISO 8601). | |
| ends_at | No | When the discount expires (ISO 8601). | |
| usage_limit | No | Maximum total number of times the discount can be used. | |
| once_per_customer | No | Limit to one use per customer. Default: false. |