How to check if a plugin really work?

files are:


<?xml version="1.0" encoding="utf-8"?>
    <type name="Magento\Store\Model\Store">
      <plugin name="set_default_currency" type="Vendor\Module\Plugin\Store\Model\Store" disabled="false" />


namespace Vendor\Module\Plugin\Store\Model;

class Store
    private $_logger;

    public function __construct(
        \Psr\Log\LoggerInterface $logger
        $this->_logger = $logger;
    public function afterGetDefaultCurrencyCode(
        \Magento\Store\Model\Store $subject,

The plugin seems to never been called.

The method Magento\Store\Model\Store->getDefaultCurrencyCode() is one in the Limitation of plugins?


Plugins can not be used on following:

  • Final methods
  • Final classes
  • Non-public methods
  • Class methods (such as static methods)
  • __construct
  • Virtual types
  • Objects that are instantiated before Magento\Framework\Interception is bootstrapped


The reason was a silly typo mistake in registration.php file.

I want to add a note for those who find themselves in this situation.

My aim was to update the default currency based on the user's geo location.

Although it is a good method to create a plugin for the getDefaultCurrencyCode function, I ran into the issue of Full Page Cache, that literally drove me crazy.

Remembering the famous acronym "RTFM" I found an easy solution in: Configure page variations

Hope Will Help Someone...

  • Did you tried adding breakpoint and debugging with xdebug? Aug 5, 2020 at 11:06
  • no, but i don get any error from magento log o server log
    – krybbio
    Aug 5, 2020 at 11:18
  • There shouldn't be an error, I ment more like checking if that block is executed. Your code is fine check application deploy mode or if logging is enabled if you are in default or developer mode. Aug 5, 2020 at 11:25
  • I'm in developer mode, logging is enabled end works everywhere else, the method \Magento\Store\Model\Store::getDefaultCurrencyCode() is called, if I hardcode the method in the core file with exit instruction it break the page.
    – krybbio
    Aug 5, 2020 at 11:30
  • try changing $this->_logger->debug for $this->_logger->critical if you are not in developer mode the debug won't log anything
    – Rus0
    Aug 6, 2020 at 7:27


Your Answer

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

Browse other questions tagged or ask your own question.