can we create two observer with same event in Magento2?

by jafar pinjar   Last Updated August 31, 2018 13:09 PM

I need to create one observer after customer is log in.

I found this is the event name customer_login

My point is I installed one third party module for some requirement. Where that extension are already created that event for their requirement.

I need to create it for some purpose in my own module.

So can I create it in my module? Is that is allowed to create same event multiple times?



Answers 2


Yes you can create multiple observer for same event

Its broadcast and listener kind of relationship

where the the dispatch code is broadcaster and the all observers are listeners

even you can observe same event multiple times in your single module

Murtuza Zabuawala
Murtuza Zabuawala
August 31, 2018 12:23 PM

Yes you can use an event multiple time, but main problem is it's observer firing order and it's controls.

My suggestion is create a separate module with dependency of current third party module, which is currently using same event and dispatch a you own event.

Arun Tyagi
Arun Tyagi
August 31, 2018 12:38 PM

Related Questions