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
David Duong
8361 gold badge12 silver badges41 bronze badges
-
1Don'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.Khoa Truong– Khoa Truong2019年11月12日 10:11:22 +00:00Commented 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?David Duong– David Duong2019年11月12日 10:32:35 +00:00Commented Nov 12, 2019 at 10:32
1 Answer 1
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
Kishan Savaliya
7,8451 gold badge14 silver badges29 bronze badges
-
I have try add cacheable="false" but it doesn't work. Do you have any idea?David Duong– David Duong2019年11月12日 10:35:20 +00:00Commented Nov 12, 2019 at 10:35
-
cacheable="false" should work, redeploy and upgrade.Shyam Krishna Sreekumar– Shyam Krishna Sreekumar2019年11月12日 10:53:46 +00:00Commented Nov 12, 2019 at 10:53
-
Thank you! I tried but it doesn't it still show login after I logged.David Duong– David Duong2019年11月20日 03:44:48 +00:00Commented Nov 20, 2019 at 3:44
default