This topic has 2 replies, 2 voices, and was last updated 1 years, 7 months ago ago by Rose Tyler
Dear Support,
I am contacting you after having discussed already with Woocommerce and SGOptimizer support team.
Since a while my website product pages cannot be cached. This is due to the fact that the caching engine cannot be trigger is there are cookies in the header.
Apparently cookies are added to the header by Woocommerce, function woocommerce_recently_viewed. This function adds cookies to the header only when the widget “recently viewed products” is active. However, on my website this widget is not active, never was and I do no plan to activate it.
Still, cookies are added to the header. Woocommerce states that most probably my theme does it behind the scene.
Could you please help me to deactivate this function if triggered by the theme? alternatively could you please give me a code that i could add to functions.php, in order to stop the function to pass cookies to the header?
Thanks in advance.
F.
Dear Fabio,
Thank you for contacting us and for using XStore.
Such cookies could be written to your headers because on one of next reasons:
1/ You have somewhere across the web-site Products element with Recently viewed products set for its Data
2/ You have Sales booster popup displayed (fake sales notification)
3/ Extra plugin writes such cookies for its reason
We can recommend you try next solution by adding the next code to your child-theme/functions.php
add_action('wp', function() {
remove_action( 'template_redirect', 'et_wc_track_product_view', 20 );
}, 70);
We can recommend you check from an incognito window or clear your browser cookies and check in non-incognito.
Otherwise, if it does not help, please, check one by one plugins you have installed and activated.
Kind Regards,
8theme team
Tagged: caching, issues, optimization, products, viewed, woocommerce, wordpress
You must be logged in to reply to this topic.Log in/Sign up