Knowledgebase

How to change the session cookie lifetime in Magento

When a visitor opens your Magento site a session cookie is used to track and keep information related to that particular customer. The cookie is valid until its lifetime expires. If, however, you have configured your web browser to clear cookies after you close it, the cookie, and thus the customer session, will be terminated after the visitor closes the browser (otherwise, the cookie will be valid even if the visitor closes and then opens the browser again).

So, for example, if a customer logs in to their account on your site, doesn't log out and closes the browser or just doesn't browse through your site for a while, and then visits the site again he will still be logged in to their account only if the cookie lifetime hasn't expired. If the cookie lifetime has expired, the session will be terminated and the customer will have to log in again. By default, the session cookie lifetime is set to 3600 seconds which is equal to 1 hour. If you want to, you can increase or decrease that time.

To do this, log in to the admin panel of your Magento and go to System menu>Configuration>Web button in the General section on the left>Session Cookie Management panel on the right. When you expand the panel you'll see an option Cookie Lifetime. Change the number to whatever you want (it's in seconds) and click on the Save Config button. Keep in mind that this will also affect the session lifetime of the admin panel. So if you log in to the admin panel and you don't use it for a while, you'll be automatically logged out after the cookie lifetime expires.

Was this answer helpful?

 Print this Article

Also Read