• Resolved Masidus

    (@masidus)


    Hello,

    I have found an issue with the WooCommerce Integration in the plugin.

    When I load any product page, WooCommerce sets a cookie which is designed to stay in the session and display up to 15 of your most recently viewed products

    set-cookie: woocommerce_recently_viewed=11477; path=/

    The issue is that this custom cookie conflicts with the plugin and therefore causes a BYPASS to be displayed.

    If I use the option to Strip out all headers then my site breaks as the basket doesn’t work because it removes the headers which send through the data.

    Could you please set it so that this cookie is no longer an issue?

    Many thanks!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @masidus,
    That is not a problem, that is how the plugin works. The plugin makes sure that the WooCommerce pages which have those WooCommerc cookies do not get cached as caching WooCommerce pages will head to breaking all the dynamic features of WooCommerce.

    WooCommerce sets the cookie so that those cookie values can be accessed by WooCommerce PHP code and the running of eCommerce functionality. If that page is cached that will mean no cookies will be saved and it will break the wocoomece functionality.

    Moreover, Cloudflare does not cache a page that has custom cookies in it thinking the content of the page might be dependent on the Cookie values.

    I will recommend you to take look at this video: https://www.youtube.com/watch?v=c-U5Nw2xTj8

    Thread Starter Masidus

    (@masidus)

    Hi @isaumya,

    Thank you for your swift reply.

    I have checked the video and I understand the concept of how the plugin is meant to function, however I assumed that because you have a WooCommerce integration that the plugin would mitigate all potential cookie conflicts automatically for WooCommerce to ensure that the plugin would work out of the box.

    It seems strange to me to be able to omit caching from the product pages for example if, by default, these pages would always be bypassed due to the response headers regardless.

    Assuming that you are able to achieve changes in the functionality of the plugin akin to WooCommerce, is there a way in which is would be possible to omit certain cookies, for example – woocommerce_recently_viewed – so that the product pages would automatically work?

    I know there is a function in the workers to be able to bypass the caching for certain cookies, so is it possible to almost reverse this function and say that when a certain cookie is present, we want to ignore the bypass request and still cache the page?

    As a workaround for anyone who faces the same problem with this certain header, you can find the solution here – https://github.com/woocommerce/woocommerce/issues/7628 – (this prevents the cookie woocommerce_recently_viewed from being set which was the final custom cookie preventing the cache from reporting a HIT)

    Hope this all makes sense and thank you for your time!

    Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    If you want to bypass a custom cookie, you need to use Worker but all woocommerce cookies are bypassed by default. I am not understanding the problem here. Can you maybe share a page URL that is supposed to be cached but are not getting cached?

    Thread Starter Masidus

    (@masidus)

    Hi there,

    So to clarify, when you say bypass for the worker, you mean that the plugin recognises that cookie and then sets the cache to BYPASS for CloudFlare correct, so the page is not cached?

    What I am after, is to be able to exclude customs cookies instead so that if CloudFlare recognises a specific WooCommerce cookie, that the cache registers a HIT and is cached.

    So in the example above, the woocommerce_recently_viewed cookie that gets set when we land on a product page is causing the cache to BYPASS as your plugin is set this way. We don’t need the function which this cookie sets, so I want to be able to say if woocommerce_recently_viewed is detected, then still cache the page and respond with a HIT.

    As I mentioned before, it seems strange that by default the plugin does not work for product pages as this woocommerce cookie is still set and therefore causes the BYPASS, when you have stated that it works out of the box and there is an option to manually choose which woocommerce pages to exclude in the GUI.

    Apologies that I can also not show you a page because I removed the offending cookie manually through hooks in function.php in my child theme so all is working now anyway.

    Hope this makes sense and many thanks!

    Plugin Contributor iSaumya

    (@isaumya)

    So to clarify, when you say bypass for the worker, you mean that the plugin recognises that cookie and then sets the cache to BYPASS for CloudFlare correct, so the page is not cached?

    – Bypassing page based on custom cookies is only available on the worker mode. WHen you enable the worker mode in the plugin you will see a section to enter your custom cookie names.

    As I mentioned before, it seems strange that by default the plugin does not work for product pages as this woocommerce cookie is still set and therefore causes the BYPASS, when you have stated that it works out of the box and there is an option to manually choose which woocommerce pages to exclude in the GUI.

    – Have you check the plugin settings > third party tab > WooCommerce? Screenshot: https://i.imgur.com/5Vs3IjB.png

    You can turn on bypass for the product page if you want. It’s not on by default.

    Thread Starter Masidus

    (@masidus)

    I am unsure of how else to word this, I don’t want to bypass any pages and of course my WooCommerce integration settings are correct.

    Put as simply as I can, WooCommerce sets the cookie woocommerce_recently_viewed automatically on all product pages.

    When this happens, CloudFlare caching is bypassed so the page is NOT cached.

    How do we make it so that all the product pages ARE cached (HIT), even when the cookie woocommerce_recently_viewed is set?

    Thank you!

    Plugin Contributor iSaumya

    (@isaumya)

    `Put as simply as I can, WooCommerce sets the cookie woocommerce_recently_viewed automatically on all product pages.

    When this happens, CloudFlare caching is bypassed so the page is NOT cached.

    How do we make it so that all the product pages ARE cached (HIT), even when the cookie woocommerce_recently_viewed is set?`

    – As I have said this before in many thread as well, when a page has any cookies in it Cloudflare doesn’t cache that page as CF thinks the value of the cookie might be used to dynamically generate some content on the page.

    When a page is cached there are no cookies in them. So, the cached pages serve like static HTML pages. But when a page has cookie, PHP needs to handle that request to parse the cookie and then change the content dynamically if it is programed to do so.

    Whhen a page is being sered from cache, PHP is not being invoked at all. So, in short, if your page has cookies in them, they won’t be cched by Cloudflare.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WooCommerce Integration Error’ is closed to new replies.