I am trying to understand about the events and observers in magento.

I created an observer to listen to an event in the checkout page. I have configured it and it triggers after the place order button is pressed.

My doubt is the observer running in background or in foreground?

Note : I saw that the error in the observer stops the order execution.

One more question I have:

If it runs in foreground, what if I have more than one observer which configured to use the same event. What will be the order of execution?

  • It depends on the dispatched event for which you have created an observer. Commented May 16 at 12:33
  • Foreground is the short answer. Follow where dispatchEvent is used in the codebase Commented May 16 at 19:06
  • @HerveTribouilloy looks like you are correct. But if i want to run the observer in the background is there any way to do that? Commented May 17 at 9:13
  • use crons, I suspect I would need to understand the context of your query. You need to add more details Commented May 17 at 9:31
  • @HerveTribouilloy But crons are supposed to run in a periodical time,right. I wanted to run this like a thread Commented May 17 at 10:10


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.