I'm implementing extension for Magento 2. I've been trying to add observer for event sales_order_save_commit_after but for some reason the observer doesn't catch the event. I've added logging for the events based on these instructions: How to get events/observers in magento 2 and it seems the event gets fired but is not catched by the observer.

Here's the frontend/events.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_save_commit_after">
        <observer name="my_dummy_observer" instance="My\Plugin\Model\Observers\Dummy" />

And here's the observer

use Psr\Log\LoggerInterface;

class Dummy implements ObserverInterface
    protected $_logger;

    public function __construct(
        LoggerInterface $logger
    ) {
        $this->_logger = $logger;

    public function execute(\Magento\Framework\Event\Observer $observer)
        $event = $observer->getEvent()->getName();
        $this->_logger->info("\n" . '[OBSERVER EVENT CATCHED]: ' . $event . "\n");

Any idea why the event is not catched with that configuration?

  • Are you missing a namespace declaration at the top of the class file or have you just forgotten to paste it in here?
    – Smartie
    Commented Feb 16, 2016 at 11:18
  • The namespace is in the actual source file. The observer itself works fine if a hook it for some common event like catalog_product_collection_load_after
    – Hannu
    Commented Feb 16, 2016 at 11:39

1 Answer 1


I figured out this one by myself. Apparently you cannot catch this event (sales_order_save_commit_after) from frontend (app/code/My/Plugin/etc/frontend/events.xml) but you need to have the observer defined in "root" level (app/code/My/Plugin/etc/events.xml)

  • FYI, <event name="sales_order_save_commit_after"> will not work for guest checkouts (not logged in user)
    – sandip
    Commented Jan 28, 2020 at 9:41

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.