I am trying to get all products based on catalog price rules and cart price rules under all categories which is valid for today's date in Magento 2
1 Answer
For catalog rule, if you look at
vendor/magento/module-catalog-rule/Model/Rule
You will find method getMatchingProductIds()
which return an array of all matching products for a particular rule.
So load the rule Model
by using rule id
by object manager or constructor injection and call getMatchingProductIds()
method. Hope it works.