Magento 2 fix can’t add product to cart in localhost
Published in
1 min readJul 3, 2017
Change your base URL from localhost
to 127.0.0.1
.
Using localhost
as the domain in your base URL causes problems in Magento 2.
Magento’s base URL configuration is located in the core_config_data
table. The following value
s may need to be changed:
web/unsecure/base_url
web/secure/base_url
For example, if you previously had http://localhost/magento2community/
, you should change it to http://127.0.0.1/magento2community/
After changing the url, flush the cache (bin/magento cache:flush
). You might also need to clear out your var directories.