Magento 2 SQL queries › Prices and promotions
Which cart price rules are active right now?
Short answer: The grid shows status but not whether today falls inside the dates. The query checks both.
In the Magento admin
- Go to Marketing › Cart Price Rules, filter Status = Active and check the dates column.
With one query
These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.
Magento Open Source
SELECT r.rule_id, r.name, r.coupon_type, r.from_date, r.to_date, r.times_used, r.discount_amount, r.simple_action
FROM salesrule r
WHERE r.is_active = 1
AND (r.from_date IS NULL OR r.from_date <= CURRENT_DATE)
AND (r.to_date IS NULL OR r.to_date >= CURRENT_DATE)
ORDER BY r.sort_order, r.rule_id;
Adobe Commerce
Product, category, rule and CMS values are stored per version and joined on row_id (why):
SELECT r.rule_id, r.name, r.coupon_type, r.times_used, r.discount_amount, r.simple_action
FROM salesrule r
WHERE r.is_active = 1
AND r.created_in <= UNIX_TIMESTAMP() AND r.updated_in > UNIX_TIMESTAMP()
ORDER BY r.sort_order, r.rule_id;
Good to know
- On Adobe Commerce, dates are handled by scheduled updates (staging), so the current version is the active one.
coupon_type: 1 = no coupon, 2 = specific coupon, 3 = auto-generated coupons.