Manage cart rules and voucher codes

ps_manage_cart_rules

Write · preview + approveBlock 2 · Commerce (off by default)Daily connectorBlock off after install

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.

NameTypeRequiredDescription
actionenum: list | create | set_activeyeslist reads rules; create adds a new inactive rule; set_active switches a rule on or off.
cart_rule_idintegernoRule to switch (set_active).
activebooleannoNew state (set_active).
namestringnoName shown to the customer (create).
codestringnoVoucher code (create). Without a code, auto_apply is required.
auto_applybooleannoApply automatically without a code (create).
reduction_percentnumbernoPercent off (create).
reduction_amountnumbernoAmount off (create).
free_shippingbooleannoFree shipping (create).
minimum_amountnumbernoMinimum cart value (create).
date_fromstring (YYYY-MM-DD HH:MM)noValid from (create).
date_tostring (YYYY-MM-DD HH:MM)noValid to (create).
quantityintegernoTotal uses (create).
quantity_per_userintegernoUses per customer (create).
shop_idintegernoShop ID in a multistore installation. Defaults to the shop in the connector address. IDs are listed by ps_get_shop_info.
confirmbooleannofalse (default) returns a preview and saves nothing. true executes, only after the user approved the preview, together with change_token.
change_tokenstringwhen: confirm=trueToken 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

Last updated: 2026-10-03