4

I am facing issue with FPC, login and register pages, are adding in Page Cache, I need to disable it.

I have idea that if we add cacheable="false" in any one of block that is used in login/register page then whole page would be excluded from Page Cache.

Is it a good way of disabling cache on specific page or is there any other way around to do this?

  • Thanks for shareing Abhishek, but I don't want to disable blocks, that could be done using hole punching or placeholder. I want do disable whole login and register page, not just block – Shoaib Munir Mar 21 at 6:02
  • 3
    adding a cacheable="false" into any block will automatically makes the entire page not to be cached so you can add that if you want it for the entire page & if you want it for a specific block you can go with the above link thanks! – Abhishek Tripathi Mar 21 at 6:15
  • Thanks Abhishek :) what cacheable="false" will do, already described in my question. My main question is, is it a good way to disable cache on page like this, or is there any other Magento way of disable cache for specific page. – Shoaib Munir Mar 21 at 6:21
  • 2
    cacheable="false" is the way to do it. best practice – Philipp Sander Mar 21 at 7:50
6

After some research and comments of Phillipp Sander, I have concluded that cacheable="false" is to good approach to make any page exclude from full page cache.

For login page, I have updated customer_account_login.xml file in my theme and updated this line:

<block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="Magento_Customer::form/login.phtml" cacheable="false">

For signup page, I have updated customer_account_create.xml file in my theme and updated this line:

<block class="Magento\CustomerCustomAttributes\Block\Form" template="Magento_CustomerCustomAttributes::form/userattributes.phtml" name="customer_form_user_attributes" cacheable="false">

This worked for me. Hope it will helpful for others too :)

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.