I have a strange issue that is currently under intensive discussion probably in different places and topics, related to different versions of Magento.
So, I have a Magento 2.4.1 instance and the following problem. From time to time, when I add a product to the cart as a non-logged-in user and then I hit "Go to checkout" and proceed with the login part, I get the following message: "Shopping cart is empty" and apparently I'm still not logged in. However, if continue the process by adding a new product, go to checkout and login, I will be logged in this time, with two products in the cart.
I have been trying to find an answer for days, but with no success. Also, I was not able to replicate the problem, no errors related to this in the error log, the cookie settings are ok from my perspective (lifetime = 86400, path = /, domain = .domain.com, http only = YES, restriction mode = no).
What is the issue behind it? How can I replicate and fix this?
Maybe it will help if I will provide you some insights:
- LiteSpeed Server is being used with LiteSpeed selected as a Full Page Cache provider;
- var/session has 2M+ files;
- The website is served over HTTPS as www.domain.com, but under cookie settings I use ".domain.com". Maybe I should use "www.domain.com";
- Perhaps it's something related to session.
Looking forward to hearing back from you.