I am making a online payment method, which is taking previous cart details if Full page cache is enabled. How can we make it non cache-able? I want to make my HTML content non - cache-able.
4 Answers 4
You have to use cacheable="false" for your perticular section or block.
ex.
<block class="Magento\Captcha\Block\Captcha" name="captcha" cacheable="false"></block>
You can get more info from core modules of magento.
-
2Doing this will render the entire page un-cached in FPC. See here: devdocs.magento.com/guides/v2.2/extension-dev-guide/cache/…mdonehundy– mdonehundy2017年10月26日 05:47:17 +00:00Commented Oct 26, 2017 at 5:47
-
How to disable cache in checkout page?zus– zus2020年08月14日 10:45:42 +00:00Commented Aug 14, 2020 at 10:45
Short answer: you can't.
Long answer:
Using cacheable="false" will make the entire page that contains this block not cacheable. So you don't disable cache for one block. You can find more references below:
You have to add with your block in layout file
cacheable="false"
For Exanple
<block class="Magento\Checkout\Block\Registration" name="checkout.registration" template="registration.phtml" cacheable="false"/>
This method is never recommended.
This is because the entire page cache cannot be handled with this approach.
Explore related questions
See similar questions with these tags.