When I clicked on add to cart or add product in wishlist then showing error as below:

enter image description here

How can I fix this issue ? Where is the form key to change or what can I do ?


3 Answers 3


Change your baseurl from http://localhost/ to

From Admin Panel :

Stores > Settings > Configuration > General > Web

Change Base URLs & Secure Base URL (Secure)

Using command line :


mysql -u $database_user -p $database_name

Access the database

use database

select * from core_config_data where path like '%base%url%';

Update Base Url :

update core_config_data set value = 'http://example.com/' where path = 'web/unsecure/base_url';

update core_config_data set value = 'https://example.com/' where path = 'web/secure/base_url';

Clean cache:

php bin/magento cache:clean

go to your env.php file and set the base url from localhost to location for env.php file is <magento root directory>app\etc

and then go to you php.ini file and look for this line max_input_var=100000 now just flush:cache and you are done

  • max_input_vars search this and update the value
    – Pramod
    Commented Dec 13, 2019 at 11:07
  • I have done changes as you suggest but still I'm facing same error
    – Rakhi
    Commented Dec 13, 2019 at 11:14

I had the same problem with magento 2.3, where Add to Cart button refreshed the page instead of adding anything in cart. where as website was working properly in Private Browsing on a custom theme.

Solutions Didn't Worked:

  • Change max_input_var=10000
  • max_input_time = 600
  • max_execution_time = 3600
  • Flush cache

Solution Worked for me:

In Configuration >> Web, I:

I am not sure if its a reliable fix or a temporary, but it resolved the issue for now.

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.