Session expires and cart empties after login

I just launched an e-commerce on Woocommerce and since day one I am facing an inconvenient trouble.

When a logged out client buys in my store for the first time and register himself at check out - OK, the transaction is concluded without any problem.

However, when an already registered client is logged out and add products to the cart and then log in during check out, the session expires and the cart goes empty.

When that happens, the following message appears: “Sorry, session expired. Return to the Shop.”

Does anyone has any clue how to solve it? Without coding - if possible.

Thank you!!


Your problem seems to be related to caching; can you please make sure you have cart excluded from your caching system? It shouldn’t be the case in Cloudways/Varnish, as WooCommerce exclusions should be included by default, but not being able to verify and judging only from what you said it points to that.

Hi Jason

Tks a lot for your attention. I tried what you said and excluded /car/ as well as the other 2 Woocommerce pages: “check out” and “my account”, by following these steps: and once completed I purged the Varnish.

However, it didn’t work and the session keeps expiring after log in. Do you know what else could be done?

I also followed the steps in this article but it didn’t work as well.

Thank you!

Hi there, its very difficult to understand what could be the problem from over here as I don’t want to blindly point you in wrong directions which not be relevant to what your problem is, however I do understand that its a problem that is effecting your business therefore critical in your perspective.

What I can suggest is 2 things, first make sure there is no other caching component which is misbehaving (Breeze? Any other plugin?), if that’s not it, I suggest you to either consult with CW agents over chat, or open a ticket with support. In either case please do get back to me if required, even personally through direct msg.

Hello Jason

Just to give you a feedback, the issue is solved.
I excluded more Woocommerce’s URLs and three cookies as suggested in this link: Adding WooCommerce (Varnish) support to an existing wordpress site

In parallel, I also opened a ticket and the guys did some tests/restarts at their side and all is running well now.

Thank you once again for your time and help, which was critical to identify it at first.

1 Like

Glad that issue has been sorted :smiley: