Answer the question
In order to leave comments, you need to log in
How to not cache the cart on a page in WordPress/Woocommerce?
Hello. Faced such a problem. Store on WordPress/Woocommerce - https://zastolami.ru/
I installed the
WP Super Cache plugin, everything was ok, but then I found a big problem with the cart, namely with the order amount in the header (in the template, actually, not in the header, but not the point), it now malfunctions, namely, when adding a product, when you go to the page on which it was already, the amount that was once displayed, without taking into account the fact that I added 2 seconds ago.
As I understand it, the problem is in this plugin, but I don’t want to disable it, since the store will grow, and it can’t be slowed down in any way. The /cart/ page itself was disabled from caching, but part of the code does not work.
How to disable caching of a part of the page (basket in the header)?
Answer the question
In order to leave comments, you need to log in
Remove interactive at the php level from the template. Leave the div in place. Through AJAX, load actual data into it every time the page is loaded.
Woo has its own front-end AJAX mechanic for just such purposes wc-ajax=get refreshed fragments
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question