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.


You have to use cacheable="false" for your perticular section or block.


<block class="Magento\Captcha\Block\Captcha" name="captcha" cacheable="false"></block>

You can get more info from core modules of magento.

| improve this answer | |

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:

| improve this answer | |

You have to add with your block in layout file


For Exanple

<block class="Magento\Checkout\Block\Registration" name="checkout.registration" template="registration.phtml" cacheable="false"/>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.