Cart count issue on home page


Cart count is showing wrong count means it's showing from the previous cache value not from the actual cart count. So, I want to prevent the cart from caching. I'm using the below method to show the cart count.
<li><a href="/checkout/cart"><span id="spancart"><?php echo Mage::helper('checkout/cart')->getCart()->getItemsCount(); ?></span>Cart</a></li>

Please let me know how to prevent this.



LiteSpeed Staff
Staff member
LiteMage will cache the cart block as private cache. So the issue is not properly hole punched for the cart. A simple way to try is to put "header" in additonal top.links block. If it does not work, need to look into your code template and layout file.
The goal is serve the whole page from cache (some from public cache, some from private cache), so PHP/Magento frame work will not be invoked at all.
We do have set up service for LiteMage if you need help.



Staff member
this discussion is too old/out of date for Magento 1/LiteMage 1, not for Magento 2.
Code change will require an experienced Magento developer to do so, not a code change by user/SA.
You are free to join openlitespeed slack channel to ask a quote for your issue.