cancel
Showing results for 
Search instead for 
Did you mean: 

can not debug checkout method

can not debug checkout method

I try to log "Magento\Checkout\Model\Type\Onepage" with my plugin that has next files.

di.xml:

<type name="Magento\Checkout\Model\Type\Onepage">
            <plugin name="shipping_test" type="Vendor\Test\Plugin\OnepageBefore"/>
 </type>

OnepageBefore.php:

<?php
namespace Vendor\Test\Plugin;
class OnepageBefore {
public function __construct(\Psr\Log\LoggerInterface $logger) {
$this->_logger = $loggerInterface;
}
public function beforeSaveShippingMethod($shippingMethod) {
$this->_logger->addDebug('Test1');
return $shippingMethod;
} 
}

I am assuming the Onepage.php file method `saveShippingMethod()` will be called to save shipping information that customer has chosen to db. When i look in my debug.log file after shopping i can not see anywhere **Test1**. I even tried to insert log inside the original file but even then no result in debug.log file? I have tried to log Magento\Catalog\Model\Product.php file and the plugin works.

 

Can someone try to log that file and what function they used also is my assumption right or not? 

 

Is it possible that magento does not allow to log (use addDebug function) Onepage.php file and if yes then why?