0

In Magento, I can disable cache for static block by add cache_lifetime="null".

{{block type="core/template" cache_lifetime="null" title="BEST SELER!!!" sku="ASS030530010" template="catalog/product/menuproduct.phtml"}}

How can I disable cache for static block on Magento 2?

asked Nov 12, 2019 at 10:05
2
  • 1
    Don't try to disable the cache. If it will disable the whole page cache of the page which contains this block. It will be the bad advice. Commented Nov 12, 2019 at 10:11
  • @KhoaTruongDinh I know it. But I have add login link so, I must check if customer login or not. Do you have any idea? Commented Nov 12, 2019 at 10:32

1 Answer 1

2

You can use this

{{block type="core/template" cacheable="false" title="BEST SELER!!!" sku="ASS030530010" template="catalog/product/menuproduct.phtml"}}

Hope this will help you!

answered Nov 12, 2019 at 10:07
3
  • I have try add cacheable="false" but it doesn't work. Do you have any idea? Commented Nov 12, 2019 at 10:35
  • cacheable="false" should work, redeploy and upgrade. Commented Nov 12, 2019 at 10:53
  • Thank you! I tried but it doesn't it still show login after I logged. Commented Nov 20, 2019 at 3:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.