Today I've created a vanilla installation of Magento 2:

  • Magento CE 2.0.3
  • Vagrant
  • Ubuntu 14.04
  • PHP 7.0.3
  • MySQL 5.6.28
  • URL: http://localhost/

Out of the box, when I try to add a product to the cart in Chrome it doesn't work:

  • The cart changes to a spinner icon
  • The text on my button changes to 'Adding...'
  • That's it ...

The same goes for reviews. When I try to add a review, it doesn't work.

However... when I try it in Firefox it works!

Can anyone tell me why it isn't working in Chrome?

6 Answers 6


Just figured it out! Apparently Chrome doesn't play nice with cookies when they are single-level domain (like localhost). Changing my environment to localhost.dev and mapping it in my hosts-file and changing the configuration of Magento 2 solved this problem!

I'll leave this answer here to save other people hours of debugging and mashing their head on their keyboard.

  • 1
    THIS! Please read detailed explaination here: alankent.me/2015/04/25/…
    – Maddy
    Commented Feb 10, 2016 at 15:57
  • good comment @Maddy. I also heard of problems with local dev domains Commented Feb 10, 2016 at 21:37

I face same problem which is mention above, I change localhost to and problem was resolved


Those who don't wish to change the localhost url and doesn't want to add vhost for this problem. Here's the quick fix.

The problem is due to form_key mismatch. The form key which gets posted during add to cart action is getting mismatched with store session form key.

Go to

vendor/magento/module-checkout/Controller/Cart/Add.php execute()

method. and comment out the first If condition.

**NOTE:**This is not a recommended solution for Production environment.

  1. Please change localhost to,
  2. To change directly from database Goto -> core_config_data table
  3. Then change secure and unsecure base url

http://localhost/ to


Infact, this is not a Magento issue, it’s that web browsers behave differently when used with a domain name like "localhost" with less than 2 dots in it. In this case the cookies are not saved and hence creates problem.

For this I suggest you to use one of two given solutions :

  1. Either use OR your ip address as domain during installation or replace localhost to OR your ip address from base url from database
UPDATE core_config_data SET value = '' WHERE path LIKE 'web/unsecure/base_url';
UPDATE core_config_data SET value = '' WHERE path LIKE 'web/secure/base_url';
  1. Or use virtual hosts from /etc/hosts in linux and C:\WINDOWS\System32\drivers\etc\hosts in windows.

For eg : Add below code at the last line of your host file where "project.dev" is your new domain name.  project.dev

Try updating the apache2.conf file.

  1. Open and edit the file /etc/apache2/apache2.conf
  2. Navigate to the place in the apache2.conf file <Directory /var/www/>
  3. Change "AllowOverride None" to "AllowOverride All"
  4. Save the file
  5. Restart apache2 by sudo service apache2 restart

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.