1

I have a plugin to change the product price, but when the plugin is called again, it's render the cache product price in the frontend. Any way to take the plugin info instead of the cache?

This is my etc/frontend/di.xml

<type name="Magento\Catalog\Model\Product">
    <plugin name="Vendor_Module_Plugin_Magento_Model_Product" type="Vendor\Module\Plugin\Model\Product" sortOrder="10" disabled="false"/>
</type>

And the plugin:

public function afterGetPrice(\Magento\Catalog\Model\Product $subject, $result)
{                               
    $result = $this->helper->calculatePrice($subject->getId());        
    return $result;
}
  • Sorry just deleted my answer, didn't read the question properly ! Sorry for wasting your time – Joao71 Jul 13 at 16:19
  • Thanks anyway!! – Erich Hans Merz Diaz Jul 13 at 16:20
  • what is the problem with cache? Is the price value different between cache and non-cached version? – Amit Bera Jul 14 at 4:34
  • Hi, yes, the price loaded dynamically. – Erich Hans Merz Diaz Jul 14 at 13:03

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.