I want to get the cart price rule applicable products list in my block. How can I get it?

For catalog rule, at vendor/magento/module-catalog-rule/Model/Rule

We have the method getMatchingProductIds() which returns an array of all matching products for a particular rule.

Similarly any function in cart Rule?

  • Hi, did you manage to find a way to do this task?
    – Mujahidh
    Dec 30, 2022 at 6:20

1 Answer 1


There is no default way to get a list of products that are eligible for the cart price rule because the cart price rule is applied at run time and catalogue price rule product collection works based on the predefine.

in simple terms, when the catalogue price indexer runs, it stores all catalogue price rule eligible products in the database, and on the frontend, it returns product collection from that table, and the cart price rule is applied when users are on the cart page because there is no data about eligible products in the database regarding the cart price rule

So for achieve your requirement you have to do the customization.

There is 2 way.

  1. Create your custom indexer class and store product ids in one custom table that is eligible for the cart price rule (recommended).

  2. Create custom code to verify eligible product run time and return products accordingly (not recommended).

I hope this information will help you.


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.