I am trying fix bug with Add to cart. I have 3 stores - Production, QA and local versions.

When I press add to cart from list or product pages it load empty cart. If I try add the same product second time, it show me shopping cart with this product. This bug only on Production and QA versions, but this is no error on my local PC. Also I deployed this store on my hosting. And there is no bug too.

I think problem with hosting where located Production and QA stores. Have You any ideas or experience with this bug? Thanks.


  • what are the exact domains? Are the cookie domains overlapping? for example a cookie set for .example.com is read on qa.example.com Oct 21, 2015 at 4:55
  • I check domain field is empty. With this settings I tested on my hosting and local PC. And it works Oct 25, 2015 at 19:02
  • The same problem occurs with a store mine. The problem is due to a divergence in form_key inserted the link to add to the cart and stored in the Cookie. But still do not know how to fix. It is used Varnish in the production environment? Oct 29, 2015 at 10:37
  • No, It is not used Varnish in the production and QA sites. I will check about form_key. But I don't think it help, because on my local PC it's work fine. Nov 3, 2015 at 8:05
  • Enable error logs in index.php and try to check for the error while adding item. May 11, 2016 at 3:59

2 Answers 2


There could be two reasons for this:

1) In the past, whenever you would visit the Magento URL "checkout/cart/add" to automatically add something to cart, the Magento session was not initialized properly. Within MageBridge, the Add To Cart Menu-Item therefore performs a little trick, that first visits a temporary page simply to initialize the Magento session and then redirects to the Magento add-to-cart URL and then redirects to the cart (or whatever redirect you have configured here). This only is an issue in the browser if the browser has no Magento cookie set - so most likely this issue can be replayed by flushing all Joomla / MageBridge / Magento cookies from the browser. However, I don't know if this is really the cause of issues, because it works in fine in all 6 testing sites I've just tested this in.

2) In Magento 1.9, the secret form key (which has already been in some forms for some time) was implemented in numerous other forms. Without the proper form key sent in the POST request, the POST request simply fails and redirects to some other default URL. This also happened for the add-to-cart URL, which means that all Magento URLs with "checkout/cart/add" also need to have an additional parameter "form_key/XXX" in it. With a Magento page, this link is automatically generated. But if you have a link in a newsletter (or a Joomla page that is not loading Magento yet), this fails. For this specific condition, there is the MageBridge option to disable the Magento form key entirely, but this will also drop security on other forms. Instead, I will build a new feature that automatically fixes this for the add-to-cart URL specifically. This will be implemented in the next MageBridge build (today).

I hope this will help you.


There may be some possibilities for occurs this type of problem 1> Session Cookie Lifetime: you can increase it from system/configuration/General/Web/Session Cookie Management/Cookie Lifetime. 2> Use of observer: Some time this type of issue occurs due to our magento observer so if you are use it then please check by disabled it.

  • In store Cookie Lifetime is set 5400. I tried change this value, but result the same. I will try use observer, if I didn't find another solution. Aug 12, 2015 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.