0

I'm trying to find out where and when will this method be triggered. I also created a plugin to do a log on this. But it seems that this is not being triggered when I click the Proceed payment button. I'm not sure where this is called. Below is my code

<!--- di.xml --->
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
   <type name="Magento\Checkout\Controller\Onepage\SaveOrder">
        <plugin name="Custom_Module_Plugin" type="Custom\Module\Plugin\SaveOrder" sortOrder="10" disabled="false"  />
    </type>
</config>

And this is the class that should be displaying the log

namespace Custom\Module\Plugin;

class SaveOrder
{    
    public function beforeExecute(\Magento\Checkout\Controller\Onepage\SaveOrder $subject)
    {
        // logging to test override    
        $logger = \Magento\Framework\App\ObjectManager::getInstance()->get('\Psr\Log\LoggerInterface');
        $logger->debug("******* THE METHOD HERE ********" . __METHOD__ . ' - ' . __LINE__);
        return null;
    }
}

Now after filling up the shipping details and selecting the payment method. When I click the Proceed button I was expecting that the method will be called but this is not being called. Any idea?

Update: I also tried doing a plugin for the checkout success page and I was able to intercept and output a log in the console. So this means that there are nothing wrong with how I did the plugin also I tried to modify the vendor/magento/module_checkout script and even if I modify the vendor directly it does not call the function/class

  • You got right to the end of the process where you hit the order success screen? – Dominic Xigen Jun 27 at 18:28
  • @DominicXigen yes. I was able to view the success/confirmation page of the order. But there are no display logs. – MadzQuestioning Jun 28 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.