I wanted to use catalog_product_save_after event in 2 different modules, Is it possible to use it?

Please help me!

4 Answers 4


Observer doesn't provide sort order. So, it may be create issue when create same events in multiple events.

So, I would like to suggest you to create plugin for that and avoid same events use in multiple module. Plugin provide you to set sort order if same function's plugin create in multiple action. You can use plugin in method type will be public. Otherwise, you can use preferences for that.

Hope, It will helpful for you.

  • 1
    Good solution. +1 :) Aug 5, 2019 at 9:09
  • Thanks @ShoaibMunir :) Aug 5, 2019 at 9:14

Yes you could use them in any number of Observers.

Events are dispatched in broadcasting manner, so any number of Observers can be listening to the same event. Either in same module or different module.


Yes, We could use multiple modules :

    <event name="catalog_product_save_after">
        <observer name="adams_mage_add_custom_option" instance="CompanyName\ModuleName\Observer\AddCustomOption" />

for another module same event :

<event name="catalog_product_save_after">
    <observer name="inventory" instance="Magento\CatalogInventory\Observer\SaveInventoryDataObserver"/>

Yes you can use it multiple times in your project.

in events.xml

<event name="catalog_product_save_after">
    <observer name="my_custom_product_save_observer" instance="Vendor\module\Observer\Productsaveafter" />

And your observer code:


namespace Vendor\Module\Observer;

use Magento\Framework\Event\ObserverInterface;

class Productsaveafter implements ObserverInterface

    public function execute(\Magento\Framework\Event\Observer $observer)
        $_product = $observer->getProduct();  // you will get product object
        //Your code here

I am unable to find the order of event, like if you use it in two different module then which observer will run first is a mystery :)
But you can use it multiple times in any module you want

  • I tried but new event didn't work and old event work
    – temper
    Aug 5, 2019 at 8:05

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.