Magento 2.1 EE

I have an observer looking to observer "checkout_onepage_controller_success_action".

I can't see what I am missing. Comparing to all the other posts and my other observers, I don't see why this shouldn't work.


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="checkout_onepage_controller_success_action">
        <observer name="wundercarparts_alsobought" instance="Wundercarparts\AlsoBought\Observer\SaveOrderItems" shared="false" />


use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer;

class SaveOrderItems implements ObserverInterface {

        /** @var \Magento\Framework\Logger\Monolog */
        protected $logger;

        public function __construct(
                \Psr\Log\LoggerInterface $loggerInterface
        ) {
                $this->logger = $loggerInterface;

         * This is the method that fires when the event runs.
         * @param Observer $observer
        public function execute( Observer $observer ) {
                $orderId = $observer->getData('order_id');
                $this->logger->addDebug(print_r( $orderId, true ));

1 Answer 1


We got this working. The code in the execute() was all wrong. Not sure why it didn't throw any errors, but its working.

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.