Manage cart rules and voucher codes
ps_manage_cart_rules
Creates discount codes and switches them on or off. New codes start switched off.
Ask Claude
„Create code WELCOME10: 10% off orders over 200 PLN, valid until the end of the year, once per customer.”
Example preview
New cart rule "Welcome 10%", code WELCOME10, 10%, min. 200 PLN, 2026-10-03 to 2026-12-31, 1 per customer, 1000 uses. Created as INACTIVE. Switch it on with set_active after checking.
Technical details
Lists, creates or switches on and off cart rules (discounts and voucher codes): percent, amount or free shipping, minimum cart value, validity dates, total uses and uses per customer. action=list only reads. A new code is created INACTIVE; you switch it on with action=set_active after checking it. There is no delete: a code can only be deactivated. A rule without a code needs auto_apply.
Parameters
Parameter names are not confirmed in module 0.3.0 yet and may change.
| Name | Type | Required | Description |
|---|---|---|---|
| action | enum: list | create | set_active | yes | list reads rules; create adds a new inactive rule; set_active switches a rule on or off. |
| cart_rule_id | integer | no | Rule to switch (set_active). |
| active | boolean | no | New state (set_active). |
| name | string | no | Name shown to the customer (create). |
| code | string | no | Voucher code (create). Without a code, auto_apply is required. |
| auto_apply | boolean | no | Apply automatically without a code (create). |
| reduction_percent | number | no | Percent off (create). |
| reduction_amount | number | no | Amount off (create). |
| free_shipping | boolean | no | Free shipping (create). |
| minimum_amount | number | no | Minimum cart value (create). |
| date_from | string (YYYY-MM-DD HH:MM) | no | Valid from (create). |
| date_to | string (YYYY-MM-DD HH:MM) | no | Valid to (create). |
| quantity | integer | no | Total uses (create). |
| quantity_per_user | integer | no | Uses per customer (create). |
| shop_id | integer | no | Shop ID in a multistore installation. Defaults to the shop in the connector address. IDs are listed by ps_get_shop_info. |
| confirm | boolean | no | false (default) returns a preview and saves nothing. true executes, only after the user approved the preview, together with change_token. |
| change_token | string | when: confirm=true | Token from the preview. Required with confirm=true. Valid 30 minutes, single use, bound to the previewed arguments and data state. |
Limits
New codes start inactive. No delete action: deactivate instead. Rule without code needs auto_apply. Permission checked per action (AdminCartRules add / edit).
What you see before anything is saved
Claude first calls the tool without confirming it. The module returns a preview (current and new values) and a single-use token valid for 30 minutes. Claude shows you the preview and saves the change only after your yes.
Related tools
- Manage sale prices (specific prices) ps_manage_specific_prices
- Revert change ps_revert_change
Last updated: 2026-10-03