fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Cached page can’t add items in cart

Hello,

I am on rocket.net hosting with CloudFlare CDN.

I noticed that cached page (sometimes) get this error making it impossible to add a product in cart:

/wp-json/woo-variation-swatches/v1/single-product/3640447?_locale=user
/wp-admin/admin-ajax.php?action=rest-nonce

 

This is the error when clicking on a variation:

/wp-content/plugins/woo-variation-swatches-pro/assets/js/add-to-cart-variation.min.js?ver=1718601116
/wp-includes/js/dist/api-fetch.min.js?ver=4c185334c5ec26e149cc
/wp-includes/js/dist/api-fetch.min.js?ver=4c185334c5ec26e149cc

 

using ?nocache parameter fixed the issue, but it comes back when pages are cached. Do you have any suggestions?

Hakik Zaman

Hi Jos,

Thanks for getting back to us.

You can try excluding the following from your caching plugin/ CDN service settings-

/wp-json/woo-variation-swatches/v1/
/wp-admin/admin-ajax.php?action=rest-nonce
/wp-js/add-to-cart-variation
/wp-content/plugins/woo-variation-swatches-pro/assets/js/
/wp-includes/js/dist/api-fetch

Thank You

Hello,

I think the issue lays in the preload of my cache with WPRocket.
The preload happens every 24h so the cache is valid for 24h.

But, I think there are nonces or other tokens in place for the cart and variations and because the validation of that expires by default after 12h I get issues with the cache. Is that correct with your plugin?

Kind regards,

Mike

Hakik Zaman

Hi Jos,

How many variations do you have with the product?

Hope to hear from you soon.

Thank You