ragumscit
By:
ragumscit

Magento shopping cart empty error

December 18, 2014 5.7k views

I am facing an issue in the magento website that whenever am trying to add anything to the cart first time when i open the browser , it shows shopping cart is empty. bit if again i add to cart the product then it goes added.

After investigating the issue it happens only suppose when i closed the browser and then all cookies got deleted automatically from browser. Then i open browser again with no cookies present, it is showing me that error of shopping cart empty. but if i keep the browser open and again try to add to cart the product from second time, then it works fine.

I have tried to increase the collie liefetime from 3600 to 604800000. It did not work. I have tried to put the value 0 also there so that cookies delete automatically on browser closed. I have tried to add cookie path to / , cookie domain to domain name , Validate HTTP user agent to yes. I have checked the server time also correct by putting a script on the website root to check it. I have tried everything whatever i got in threads of magento for the issue am getting.

So if anyone have tried anything else which i have not tried and which can really solve my issue. It will be thankful. So please reply here and let me know , am fed up from solving this issue

3 comments
  • Hi ragumscit

    I have tried everything like you did...but cant solve the issue....did you manage to solve this issue

    If so, please help me with it

    awaiting your response. Thanks

  • Hi,
    i'm try every way same you. but it still not working normaly. T___T
    awaiting solution for fix it.

    Thanks

  • This issue come due to the cookie problem, not in browser but in Magento itself.
    As per default Magento, default cookie’s lifetime is set to 3600 (1 hour). But if the end users computer time runs ahead of server’s time, then 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 issue, 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 the admin panel: Sytem -> Configuration -> Web -> Session and Cookie Management Set cookie lifetime to 86400 and save. Functionality will work as expected.

    If still you are facing the issue then check if there are two cookies are setting with same name: one for domainname.com and another for www.domainname.com. then need to change the cookie domain to www.domainname.com in Admin cookie settings, So that 2nd cookie disappeared and it will works as expected.

1 Answer

This question was answered by @Xender:

This issue come due to the cookie problem, not in browser but in Magento itself.
As per default Magento, default cookie’s lifetime is set to 3600 (1 hour). But if the end users computer time runs ahead of server’s time, then 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 issue, 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 the admin panel: Sytem -> Configuration -> Web -> Session and Cookie Management Set cookie lifetime to 86400 and save. Functionality will work as expected.

If still you are facing the issue then check if there are two cookies are setting with same name: one for domainname.com and another for www.domainname.com. then need to change the cookie domain to www.domainname.com in Admin cookie settings, So that 2nd cookie disappeared and it will works as expected.

View the original comment

Have another answer? Share your knowledge.