Magento – Persistent Shopping Cart and Guest / Anonymous Users

cookiemagento-1.9persistentshopping-cart

Our site does not use accounts or logins, so basically all of our users go through guest checkout.

I was under the impression that the "Persistent Shopping Cart" does exactly that – saves the contents of the cart even for users who do not register.

So if an anonymous user comes to the site, adds items to the cart and leaves, his cookie is still saved in case he returns to the site.

Apparently I was mistaken – after further reading the documentation I understand that the feature is used more towards accessing the cart from multiple devices while logged on and persisting the cart.

So now, assuming I want to ANONYMOUS, GUEST users to be able to return to the site and maintain their previous cart state, what is the best way to do that?

Should I just extend the session cookie to a year? I'm not sure what are the consequences of doing that if that's the best /easiest way?

Thank you!

Best Answer

The time duration for which Item saved into cart depends on two parameters

  1. Magento Admin: System -> Configuration -> Web -> Session Cookie Management Cookie Lifetime
  2. PHP.ini - session.gc_maxlifetime

Here your Session Cookie Management Cookie Lifetime should be less than the session.gc_maxlifetime.

The session.gc_maxlifetime will be honored first and then cookie lifetime.

So once the session is expired the cart will be emptied.

Related Topic