I want to create observer for particular page cache disable.

1 Answer 1


You can disable the cache in a page marking any block of the page like cacheable="false". If any block of a page is marked as cacheable="false", the full page will have the cache disabled.

To create an uncacheable page, mark any block on that page as uncacheable in the layout using cacheable="false". https://devdocs.magento.com/guides/v2.2/extension-dev-guide/cache/page-caching.html

An example here. https://github.com/magento/magento2/blob/2.0/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_returnurl.xml

If you want specify a cms page like no cacheable, you have to update the section layout_update_xml in the admin cms page and write this:

<referenceContainer name="content">
   <block cacheable="false"/>

You have to be careful with this, because it affects the performance of the web.

  • Hello , one block call in cms page with cacheable="false" but that not working.... some other hints.... Jul 12, 2018 at 2:35
  • I can try , and call the block on cms page but not working, here see...{{block class="Magento\Framework\View\Element\Template" name="custom.cart.page" template="Custom_Custom::cmscart/cart_details.phtml" cacheable="false"}}, block call perfect but when i add to cart some products than new added product not display that page,when i clear cache than display ,means the cacheable="false" not Working Jul 12, 2018 at 3:18
  • @RasikMiyani I have updated my answer.
    – raumatbel
    Jul 12, 2018 at 6:47
  • Can you mark as valid the answer?
    – raumatbel
    Jul 12, 2018 at 7:49

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