Magento shopping cart empty error

  • Posted on December 18, 2014
  • ragumscitAsked by ragumscit

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

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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 and another for then need to change the cookie domain to in Admin cookie settings, So that 2nd cookie disappeared and it will works as expected.

View the original comment