Solved: Magento 2 Add to Cart Button Not Working

Its been almost two years now since Magento 2 has been released, and it’s getting better with each day due to the contributions from the developers all over the world. However, there are certain issues you may face while working with Magento 2. One of them is “Magento 2 Add to Cart button not working“.

There are many reasons for add to cart not working or stopped working. Some of them are infinite redirection loop, 3rd party extension conflicts, form_key mismatch etc.

Magento 2 Add to Cart button not working on Home page

Most of the time, the issue arises due to change in custom theme, adding custom CSS, adding products to cart from home page and refreshing the page doesn’t add the product to cart.

Such a situation arises when there’s something wrong in the cache.

Follow the below steps to solve the issue:

  1. Login to Magento 2 backend.
  2. Go to System > Cache Management and select all of the caching options built in your Magento 2.
  3. In the drop-down, select Enable and then click on Submit.

 

enabling cache types

And you’re done!

Magento 2 Add to Cart button not working on the Categories and Product Page

When a user adds a product to cart from categories or product page, he/she is redirected to the checkout page with an empty cart. This happens because of the domain change as Magento 2 stores root URL in the third path without affecting the first version.

To resolve the issue, you need to run additional SQL query:

Moreover, delete the cache using the following command:

Now that you have the solution, don’t let such small issues stop your live Magento 2 store work well. ?
Please mention your doubts in the comment section to help you out if you stuck somewhere. Also, let me know where have you used this solution and what arises this issue!

Rate the blog post with 5 stars if you liked it.

Happy Coding!

4.9
(based on 14 Reviews)
Solved: Magento 2 Add to Cart Button Not WorkingAuthor Magento Badge

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

2 Comments

  • Kamal

    Hi Sanjay,

    I have problem on my store that add to cart button is not working on the product page. But it is working on the homepage.

    Nothing happens on product page when I hit add to cart button. There is no error showing in the console and nothing happens.

    Surprised what is going on and confused what is the reason behind this.

    Please help immediately.

    Thanks and Regards,
    Kamal

    • Sanjay Jethva

      Hello Kamal,
      Please contact us for your custom requirements if you want to avail professional help of our certified Magento developers.
      Your issue requires customization which is out of the scope of the above blog’s solution.
      Thank you.

Leave a Reply

Your email address will not be published.