We created a custom phtml template with some customer specific php, that must be loaded for each customer/pageload again. So we created the phtml template and added the following code to layout/default.xml
The problem now is that this element is cached by block cache and FPC (Varnish). We do kno that it’s possible to add the cacheable="false
, but this prevents the entire page from being cached. And this custom template is loaded on each page, so we disable the entire cache. How can we exclude this template from being cached?
Code:
<referenceContainer name="after.body.start">
<block class="MagentoFrameworkViewElementTemplate" name="country_switch_notice" template="Magento_Theme::html/switch_notice.phtml" before="-" />
</referenceContainer>