Magento 2 products not being added to cart

4.8k views Asked by At

The "Add to cart" button changes to "adding" and stays like that. It does nothing after that.It doesn't work from anywhere not even product details page.

Magento products not going in cart

2

There are 2 answers

0
arvind jha On

go to PHPMyAdmin coreconfigdata

change URL localhost/project to 127.0.0.1/project

0
P S On

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 values may need to be changed:

  • web/unsecure/base_url
  • web/secure/base_url

For example, if you previously had http://localhost/yourproject/, you should change it to http://127.0.0.1/yourproject/

After changing the url, flush the cache (bin/magento cache:flush). You might also need to clear out your var directories.