Magento 2 SQL queries › Prices and promotions
Which catalog price rules apply to the Wholesale customer group?
Short answer: Rules link to groups in catalogrule_customer_group. Filter by the group's name.
In the Magento admin
- Go to Marketing › Catalog Price Rules and open each rule to see its Customer Groups.
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.is_active, r.from_date, r.to_date, r.simple_action, r.discount_amount
FROM catalogrule r
JOIN catalogrule_customer_group cg ON cg.rule_id = r.rule_id
JOIN customer_group g ON g.customer_group_id = cg.customer_group_id
WHERE g.customer_group_code = 'Wholesale'
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.is_active, r.simple_action, r.discount_amount
FROM catalogrule r
JOIN catalogrule_customer_group cg ON cg.row_id = r.row_id
JOIN customer_group g ON g.customer_group_id = cg.customer_group_id
WHERE g.customer_group_code = 'Wholesale'
AND r.created_in <= UNIX_TIMESTAMP() AND r.updated_in > UNIX_TIMESTAMP()
ORDER BY r.sort_order, r.rule_id;
Good to know
- Change
'Wholesale'to your group's name exactly as it appears in Customers › Customer Groups. - On Adobe Commerce the link table joins on
row_id, the rule's version, notrule_id.