Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    magento-hyperlocal-marketplace-guide

    Observer on mass update attributes of product in Magento 2

    Observer on mass update attributes of product in Magento 2

    Whenever a product is saved, catalog_product_save_after event is dispatched and we create observer that will listen to any changes made in products. But there is a time when catalog_product_save_after event is not called when product is saved. This happens when mass action Update Attributes is applied to products.

    So, what you can do is use event catalog_product_attribute_update_before in this case.

    In file /vendor/magento/module-catalog/Model/Product/Action.php this event has been dispatched before updating the products


    So in your observer you can get these parameters like this-


    In this way you can get the product ids and the attributes data that was updated.
    Hope this helps.
    Happy coding 🙂

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    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
    Close