9

I have customBlock in product_view. How do disable cache for this?

8

I assume you want to disable caching of the block by PageCache module. There are two options available:

  1. Set cacheable="false" attribute in layout. But this will make the whole product page non-cacheable, probably is not what you want. Keep in mind existing issue with cacheable="false" on product view page
  2. Use UI components
  3. Do not set _isScopePrivate property to true in your block, this is deprecated functionality
  • Thank alot . i will try it and answer you soon – xanka Dec 11 '15 at 10:04
  • @xanka Did it help? – Alex Paliarush Dec 18 '15 at 9:07
  • 1
    @Alex Paliarush I tried to set _isScopePrivate to true in my custom block to add a specific logo for the customer of tier price; but it seems not work. My custom block was not rendered by ajax. – Ricky.C May 26 '16 at 6:54
  • 2
    cacheable="false" disables caching for the whole page! This is a recipe for performance degradation. See inviqa.com/blog/how-full-page-cache-works-magento-2 for details about caching. – Dmitri Sologoubenko Jan 30 '17 at 12:37
  • @Rick.C "Do not use the $_isScopePrivate property in your blocks. This property is obsolete and won't work properly." Find this in magento guide: devdocs.magento.com/guides/v2.1/config-guide/cache/…. I think this links is also helpful to guide how to disable cache in certain blocks. – user1506075 Mar 15 '17 at 0:57

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.