Create PrestaShop Cart Rule
ps_create_cart_ruleCreate a PrestaShop discount voucher or coupon code with percentage or fixed amount reduction, set start/expiry dates, and define total and per-customer usage limits.
Instructions
Create a discount voucher/coupon code with a percentage or fixed amount reduction.
⚠️ Requires PS_READONLY=false and POST enabled on the PrestaShop Webservice key.
Args:
name: Internal name for the rule (required)
code: Voucher code customers enter (leave empty for auto-apply)
reduction_type: "percent" for percentage, "amount" for fixed amount
reduction_value: Reduction value (e.g., 10 for 10% or 10.00 for €10)
date_from: Start date (ISO format: YYYY-MM-DD HH:MM:SS)
date_to: Expiry date (ISO format: YYYY-MM-DD HH:MM:SS)
quantity: Total number of usages allowed (default: 1)
quantity_per_user: Max usages per customer (default: 1)
lang_id: Language ID for the name (default: "1")
Returns: Created cart rule ID and details.
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": {
"name": "<name>",
"reduction_type": "<reduction_type>",
"reduction_value": "<reduction_value>",
"date_from": "<date_from>",
"date_to": "<date_to>"
},
"name": "ps_create_cart_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Voucher code (empty = auto-apply) | |
| name | Yes | Internal name for the rule | |
| date_to | Yes | Expiry date (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS) | |
| lang_id | No | Language ID for the name | 1 |
| quantity | No | Total usages allowed | |
| date_from | Yes | Start date (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS) | |
| reduction_type | Yes | Type of reduction | |
| reduction_value | Yes | Reduction value | |
| quantity_per_user | No | Max usages per customer | |
| confirmation_token | No | Confirmation token for destructive operations |