I am running Magento 2.3.2. I am fairly new to Magento 2. I have everything running (or so it seemed) and had enabled full page cacheing.
Yesterday I discovered a problem. If I add one product to the cart, all is ok. If I "continue shopping" and then go to a category page, select a second product, the mini-cart is immediately emptied. Second product is in the actual check out cart, first is not.
I investigated and found that the problem is the second product is being loaded as a cached page, and this somehow clears the mini-cart.
When I disabled full page cache, the scenario above works fine. 2 or more products in cart are all ok.
I'm not sure what to do to fix this problem. Suggestions?
P.S. My hosting environment does not support Varnish. They use nginx.
Are you sure that no other caching is running except the Magento prebuilt?
Hi @debrarhogan
Generally FPC modules (full page cache) also cache things like cart content. They just cache entire pages most of the time.... FPC's come in many varieties. So care to elaborate what module you are using.
What you are trying to do is HOLE punching. This allows content to be loaded and passed on through the backend. Ex. the cart's content / block should not be cached / hole punched and the data should be collected either through an html request/ajax/esi method..
Based on the FPC module you should search how to disable the block cache on the cart.
The problem may be the minicart that gets cached. Try to disable cache for the minicart only.
Forgive me for being a rookie here.
I've read that Magento 2 does not support HOLE punching. However it appears that you disable the cache via xml files.
So the rookie questions:
1. How do I find the right cart module to disable the cache?
2. It seems strange to me that this wouldn't be automatic in Magento 2 otherwise everyone would be having / complaining about this problem so I figure it is some configuration thing that I haven't done? Could this be caused by my theme (Infortis Ultimo)?
Any help truly appreciated.
Further update. I found the sole block for the minicart and updated it as follows:
<block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="logo" template="Magento_Checkout::cart/minicart.phtml" cacheable="false">
I thought that any page that uses the mincart would not be cached and this would solve the problem. NO LUCK! If a customer tries to add a second product either via category --> product page or product page directly, the cart is emptied.
Only thing that works is turning off FPC. HELP!