Woocommerce basket, checkout, account pages & ajax cart not working


#1

Dear Cloudflare community,

We’ve recently put our wordpress test site https://www.i-alevel.co.uk/ on cloudlfare’s free plan but we are having issues with the woocommerce (standard storefront theme) ajax add to cart and other pages not working and just returning blanks.

The ajax cart and pages listed above all work fine when logged in as admin.

Please feel free to navigate to the domain to replicate.

I’ve tried disabling rocketloader as I saw in one of cloudflare’s articles but this doesn’t help I’m afraid.

I’ve gone through most settings and tweaked but had no joy either.

I’ve also configured 2 page rules as per cloudflare’s guide: 1) to bypass ajax (e.g. www.i-alevel.co.uk/ajax* > settings ‘cache level: Bypass’) and 2) cache everything else but they don’t work either. I have managed to get other page rules working (tested a simple redirect page rule which worked fine after purging the cache and waiting a minute) just not these.

I’ve tried pausing cloudflare, uninstalling the cloudflare plugin for wordpress, deactivating w3 total cache and reactivating to check for conflicts and nothing has been able to stop the basket page being empty and the ajax cart not adding more than 1 product to it (it then just goes back to empty as soon as you navigate to another page).

As you’ll see from the site, we’re looking to scale a 100k product site upwards and understand that there may be costs involved to get the speed and caching functionality we need, but we’d want to atleast see if we can run an ecommerce store with those dynamic cart elements on cloudflare free plan first.

Can you advise where we might be going wrong? (Or if this is only solvable by upgrading plans)

Many, many thanks in advance (I don’t know what to try next!)


#2

To me this looks like a session issue. It seems it simply does not keep any session, the only cookie being managed is Cloudflare’s.

But you are probably better off asking that question at https://woocommerce.com/contact-us/


#3

Thanks for your reply Sandro. That would make sense. I was hoping someone in the community may have run across this before as I’m guessing cloudflare is used quite widely for ecommerce sites too.


#4

Maybe someone has, but I’d still assume you’d get a faster response from the developer.


#5

To Woocommerce I go! Will report back


#6

Although we’ve used woocommerce for years we’ve not actually purchased anything from them (surprised me). If you haven’t purchased any of their plugins you can only get support through the forums unfortunately so I’ve posted there. Hopefully someone will take a look.


#7

Sandro, how do I best see which cookies are being managed?


#8

The network tab in the developer tools shows which cookies are sent.


#9

Hi Sandro, I’m afraid no one on the woocommerce side of things has replied. So I can debug further, if I paused cloudflare would that effectively stop cloudflare’s cache completely? If I purged the cache completely then paused cloudflare I should be just going straight to my origin server correct? If I then replicate the issue can i rule out cloudflare as the culprit? At the moment it does look like a cloudflare issue as on our duplicate test site which has the same w3 total cache settings etc but has never had cloudflare everythign works as expected.

Thank you for your help


#10

You originally mentioned

I’ve tried pausing cloudflare […] to check for conflicts and nothing has been able to stop the basket page being empty

So I assumed you already ruled out Cloudflare.

Pausing Cloudflare will make your site resolve straight to your origin.


#11

Hi Sandro, I did but I’m starting to think something’s a bit wrong here. Just now I’ve:

  • purged the cloudflare cache in cloudflare.com
  • paused cloudflare
  • deactivated the cloudflare wordpress plugin
  • disabled all settings in W3 total cache
  • purged all caches ****
  • deactivated W3 total cache

opened an entirely different browser to check (in IE, never visited the site using this before) - still the exact problem persists.

**** When I purged all caches in w3 total cache I got the message: Failed to purge: CloudFlare cache: Not authenticated

I’ve had this problem a bit before where I’ve clicked purge everything in cloudflare and waited 5 minutes - navigated to the site again in a new incognito browser and everything’s still there cached. The only sure fire way I’ve found for cloudflare to 100% purge a cache was to use the custom purge option and to manually put the URLs in.

Could it be that cloudflare isn’t actually purging it’s cache?


#12

I dont think it is a caching issue. The cookie does not get set in the first place and the cookie should not be transferred via anything cacheable.

From what I can tell the problem appears to be solely session related.

And as you mentioned you did not pause Cloudflare only this time but already before.


#13

Thank you so much for sticking with me on this one. Could I ask a big favour? I’ve bought our other test site (the one without cloudflare out of maintenance mode. Would you mind looking at the cookies of http://www.internationalalevel.co.uk/shop/ (the one without cloudflare) vs https://www.i-alevel.co.uk/shop/ (the one that currently has cloudflare paused) are they generating the same cookies?

Thanks Sandro, I’ll do the same but I’m not entirely sure what I’m looking for!


#14

when items are added to the basket


#15

Cookies generally seem to get set only when add an item (send a request to /?wc-ajax=add_to_cart)

For internationalalevel.co.uk the following ones are set

image


For i-alevel.co.uk on the other hand nothing appears to be set. The cookie page above is empty altogether.

Random guess, can you check if your cookie store on the server side is properly configured? If it cant save the cookie information, maybe it doesnt send it to the client either (not sure right now how PHP handles that in detail, but seem to remember to have come across similar issues).


#16

Thanks mate, this is very interesting. I’ve never had to dig this far into developer tools in chrome before. On i-alevel.co.uk when i click on a ?wc-ajax=add_to_cart request i only get Headers, Preview, Response and Timing across the top and no Cookies whereas on International Alevel I get a cookies tab. Really useful to see. I’m not entirely sure how to check serverside so will try and research. Both of these websites are hosted on digital ocean servers so most stuff has been done in the command line. Thank you so much for your help. Maybe stack will have an answer for me. Will look now:)


#17

This topic was automatically closed after 31 days. New replies are no longer allowed.