Jul 9, 2011

Magento: Can’t login/add items in Chrome and IE

Problem: In Chrome and IE, user as well as admin are unable to login as well as add items to cart. In Firefox, everything works fine.

Solution: This is due to the cookie problem, not in browser but in Magento itself. In Magento, by default cookie’s lifetime is set to 3600 (1 hour). But if the end users computer time runs ahead of server’s time, cookies will not get set for magento frontend as well as backend. For example, end user’s computer time is 1 hour forward than server’s time, that means the cookie (holding user’s session id) will expire as soon as user logs in or tries to add an item.

To solve this, set cookie’s lifetime to 86400 (1 day) instead of 1 hour and everything will work as expected. You can also set cookie lifetime to 0, so that cookie will only expire when the user’s browser is closed.

Go to: Magento backend -> Sytem -> Configuration -> Web -> Session and Cookie Management
Set cookie lifetime to 86400 and save. Everything will work as expected now.


  • Thanks. Really help me a lot.

  • Just wanted to say thanks for saving me from a major headache! This was exactly what I needed to know.

  • Thanks a lot mate, just what I needed!

  • Excellent thanks dude, I had tried a number of other solutions for this problem – as I was running in a VM and pausing it every night it fell behind by around 8 hours.

    I didn’t change the value above instead just resynced the time on the server using “ntpupdate pool.ntp.org” and it started working again.

    Thanks for pointing me in the right direction though!

  • I had the same problem with our VM and we use url as vm-magento. when i changed it to IP it worked well without any other changes. We have EE

  • Hi,
    I had same problem….

    I resolved this by using another way….

    Reason: If your host disk space is limited for your plan and after some days if it exceeds/full then cookie and session have no space to store…so this kind issue can occurs…

    Solution: Clean up space…remove unnecessary data ….


  • Very useful. Thanks Kalpesh.

  • Not working.

  • its not working….help me..

  • It’s working for me. Thank you.

  • Thanks, dude! Saved my day!

    But very shortsighted design decision from the Magento devs.

  • Thanks frnd , it was really very helpfull .

  • 2nd Solutions:
    Go to app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file within your magento directory.
    Find the code:
    $cookieParams = array(
    ‘lifetime’ => $cookie->getLifetime(),
    ‘path’ => $cookie->getPath(),
    ‘domain’ => $cookie->getConfigDomain(),
    ‘secure’ => $cookie->isSecure(),
    ‘httponly’ => $cookie->getHttponly()

    and replace with

    $cookieParams = array(
    ‘lifetime’ => $cookie->getLifetime(),
    ‘path’ => $cookie->getPath()/*,
    ‘domain’ => $cookie->getConfigDomain(),
    ‘secure’ => $cookie->isSecure(),
    ‘httponly’ => $cookie->getHttponly()*/

    save the file ,, It must works for all browsers

    • Thanks.it is worked for me. Good Job, thanks once agian to azhar farooq

  • Seems to have worked for us and resolved a very upsetting problem that was costing us lost revenue and unhappy customers. Thanks Kalpesh!!

  • Login is not working anywhere in version 1.6.0.

    Can anybody help?

  • … [Trackback]…

    […] Informations on that Topic: ka.lpe.sh/2011/07/09/magento-cant-loginadd-items-in-chrome-and-ie/ […]…

  • This didn’t help, I also tried Azhar’s solution with no luck. Any other ideas?

  • Thanks a lot! I’ve been looking all day for a solution and finally I found something that works even on magento … You’re great!

  • Thanks a lot for this. It was very helpful.

  • … [Trackback]…

    […] There you will find 57684 more Infos: ka.lpe.sh/2011/07/09/magento-cant-loginadd-items-in-chrome-and-ie/ […]…

  • Thanks so much mate I nearly had a heart attack when a customer phoned me about this on his Magento site and I had no idea what to do to fix it. This fixed the issue.

    Thanks for your help,

  • Thanks! I was already pulling my hair out because of this. A little sidenote: I also had to set HTTP only to No in my admin for it to work (on my localhost running Vagrant)

  • I tried everything didn’t work UNTIl I read what Giel did which was turn the HTTP only to NO. Worked perfect!

  • Saved me, Magento 1.6.1, changed cookie lifetime to 86400 and was then able to login/add products using IE.

    I had no problems with Chrome or FF.

  • thanks u save me u r so nice man

  • Thanks

  • In Case, that you dont see any cookie named “frontend” or “adminhtml”, wenn you reload the page, the magento cookie wasnt set. In my case I have a wrong cookie_domain. I used “null” instead of “NULL”.

    As I set my cookie_domain to NULL in core_config_data, the problem was solved

Leave a comment


Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!




Magento top 50 contributors

Magento top 50 contributors