3

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 1

7

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.