I am overriding the frontend price by using the MagentoCatalogModelProduct plugin like so:
Sulman/Mymodule/etc/frontend/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogModelProduct">
<plugin name="sulman-product-model-frontend" type="SulmanMymodulePluginProductPlugin" sortOrder="1" />
</type>
</config>
SulmanMymodulePluginProductPlugin.php:
<?php
namespace SulmanMymodulePlugin;
class ProductPlugin
{
public function afterGetPrice(MagentoCatalogModelProduct $subject, $result)
{
return '123.45'; // just testing
}
}
?>
This is working correctly but when FPC is enabled the prices do not update. (e.g. if I load the page, then change the return price to 789.99 then refresh frontend the price stays at 123.45 – If i then clear cache 789.99 then shows).
How can I get around the cache?
Thanks
Magento 2.4.1