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.


    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 received your message and our expert will get back to you shortly.
    Send Again