add to cart button / PHP / Cache
-
I’m facing a tricky problem: to display the “add to cart” button, I have to go through a piece of PHP code that allows to display the button under the product image, directly in the shop.
BUT, I use a cache plugin, WP Rocket. And the cache does not work with PHP. There are documentaton on this.
My question is : is there a way to have the “show to cart” button other than through the php code ?The code is (added via Snippet plugin)
// Add "Add to Cart" buttons in Divi shop pages
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 20 );here there is a clear view of what happening when the shop page is not exlude from the cache https://www.loom.com/share/7a3d7c98b3ff4c30b678a1c5a0457aed?sid=7f9881cf-0f1e-41d1-9d51-d17959c8c101
For now, I exclude the url of the WProcket’s cache. But if we reactivate it, after a while, the client will face the probleme which have been cast in the video : the product is not adding to the cart and the button keep spinning again and again.
I figured out that the probleme should come from the PHP that is used to display the “add to cart ” button on shop page, which seems to generate a conflict with the cache. I tried several time and every time the cache is not cleared, the moment comes when the button is spinning around without actualize itself.
May be I can share my cache’s setting here but I dont know how…
thank you
The page I need help with: [log in to see the link]
The topic ‘add to cart button / PHP / Cache’ is closed to new replies.