How To Fix Add To Cart Button Not Working In Magento 2

The add cart button stops working suddenly without knowing the reason. In this post, I will guide you on How To Fix Add To Cart Button Not Working In Magento 2.

It’s hard to imagine the consequences of an inactive add-to-cart button for an e-commerce store. Your customers can’t make the purchase, which both reduces revenue and reduces the store experience.

Don’t worry this post will help you fix that error. Compare your error with the cases below and follow the instructions.

Magento 2 Add To Cart Button Not Working On Home Page

Normally, when the user presses the add to cart button from the home page, it displays a message stating that the item has been added to the cart. But when error, cart shows empty.

The reason for this problem may be due to cache. Please enable all cache options from Magento 2 Admin Panel to resolve this issue.

1. Log in to Admin Panel.

2. On the Admin Panel sidebar, go to SYSTEM > Tools > Cache Management.

Go to SYSTEM > Tools > Cache Management

3. Select all of the caching options. Then in the drop-down, select Enable and then click on Submit.

Enable all caching options

Magento 2 Add To Cart Button Not Working On The Categories And Product Page

The cart is empty even though you added the product from the category or product page. This case is resolved by running the SQL query. Since Magento 2 stores root URL in the third path (e.g.: design/head/includes), the problem usually occurs after a domain change or hosting change. Follow the steps below to fix the error.

1. Run the additional SQL lines below:

UPDATE core_config_data
SET value = REPLACE(value,'<old-root-URL-or-domain>', '<new-root-URL-or-domain>')
WHERE path = 'design/head/includes';

2. Use the below command to delete the cache:

rm -rf var/cache/*

This is the end of the How To Fix Add To Cart Button Not Working In Magento 2.

Follow us for the more helpful posts!

We hope this is a useful post for you How To Fix Unique Constraint Violation Found In Magento 2.

Thank you for reading!

3.5 4 votes
Article Rating

Aaron LX

Aaron is a passionate writer, crazy about shopping, eCommerce and trends. Besides his outstanding research skills and a positive mind, Aaron eagerly shares his experience with the readers.

Leave a Reply or put your Question here

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x