Search code examples
shopware

Shopware clears cart and redirects to registration page on session timeout


Customers have their cart cleared after their session times out, but are not warned about this, and are confusingly redirected to the registration page. Is this standard Shopware behaviour? Or have I broken something?

Setup: Using Shopware 5.4.6 via composer.

Recreating the problem: A customers visits the site (and maybe add items to their cart), then re-visits after their session has timed out, adds more items to their cart and continues to checkout.

Expected behaviour: I would expect to see a warning that the session has timed out and maybe return them to the homepage or an empty cart.

Actual behaviour: What actually happens is that they can still add items to their cart, but when they try to checkout their cart is emptied and they are redirected to the registration page.

This looks to be caused by a new session being started, and is very confusing for customers as the registration page looks a lot like the start of the checkout so they fill in some name and address details... but then they do not progress to the checkout as their cart is inexplicably empty.

The question is whether the behaviour after sessions time out is normal, and if so if there's any way to make it less awful for visitors?

Note on sessions: Sessions time out - this is normal, and the timing of this is controlled via php.ini. That's not the issue here - you could set the time out to a day or a week and this issue would still occur.


Solution

  • Currently this is the default behaviour of shopware. You need to add your own logic via plugin. The login and cart is lost after the session timed out.