Menu Close
    Hire us Request quote Reading list Switch to dark mode

    Product collection which satisfies catalog rule in magento2

    In Magento2, if you are adding a functionality in which you want to get product’s collection or product ids which satisfies the catalog rules, then you can use the gives code:


    $storeManager, is an object of StoreManagerInterface.

    $catalogRule, is an object of CatalogRule collection.

    getMatchingProductIds(), it return the all product ids which are used in conditions according to websites, and assign 1 for the product ids which satisfies the condition.

    $resultProductIds, returns an array in which product ids are as keys and catalog rule’s name is an value.

    . . .
    Subscribe Articles

    Just enter your email below to subscribe and receive weekly updates about the most interesting similar articles.

    You need to accept conditions to receive letters.
    You've Subscribed!

    Share article via

    . . .


    Hope this functionality helps you to implement functionality in magento2.


    Thank you.

    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again