Fixed: Magento 2 Add to Cart Button Not Working

The Most Popular Extension Builder for Magento 2

With a big catalog of 234+ extensions for your online store

With the proliferation of the internet, online shopping has become an everyday practice among millions of people worldwide and keeps on growing. When visitors come to your e-commerce store and are ready to make a genuine purchase, they only take some specific actions like adding to the cart and completing the checkout page. All is done, and they are waiting to receive their desired items. People prefer purchasing online with a simple process at home instead of going out to brick and mortar stores.

Thanks to technology, store owners can make the customer journey more comfortable. However, it will be a significant effect if one of the processes has technical problems, especially like add to cart button. In Magento 2, add to cart button, which is not working is the most worried of business doers. In the blog, we would love to give some suggestions to fix this issue.

Table of contents

What is an add to cart button and its benefits?

The add to cart button appears on different pages of your website like the home page, product page, and category list page. With this button, consumers can add their desired items to the shopping cart, then go to the checkout page or continue their shopping journey.

Add to Cart button during the shopping journey
Add to Cart button during the shopping journey

The appearance on this button of various pages is the perfect call to action to remind web surfers to purchase an item as soon as they like it. Showing the add to cart button’s visibility will increase the conversion rate by encouraging customers to take action and attract the impulse buys on your e-commerce store.

To increase the customers’ chances of buying, it is vital to make their shopping journey convenient. Online shoppers will not be satisfied if they have struggled while choosing their desired items. This is where the add to cart button plays its role because it allows customers to put the selected product to their cart then continue shopping. The add to cart button displays on various pages helps them to find faster.

Why add to cart button not working on Magento 2 stores?

It is a nightmare for web owners if the add to cart suddenly stops working on your Magento 2 e-commerce store. One of the most harmful effects that can cause your store is losing sales. Potential customers may drop their cart and leave your website if they find out the add to cart button stop working. The more severe impact is that visitors will evaluate your website with the not good technical background, and they are skeptical about the security of the website. In consequence, they will not go back to purchase in the future.

Store admins do not want this to happen so that they often find the reason for this problem and try to fix it in the shortest time. There are various reasons for add to cart not working. It may be due to the conflict with themes or third-party extensions.

If store admins customize themes by modifying coding or add custom CSS, the add to cart button issue may arise. Besides, the problem might happen due to a domain change as Magento 2 stores root URL in the third path.

How to fix the error of adding to cart button is not working in Magento 2?

Magento 2 add to cart button does not work on home page

If this such situation occurs, we suggest the following steps, which may resolve the problem.

The first step is to login Magento 2 admin panel. Then, go to the path System -> Cache Management.

Cache Management
Cache Management

In the cache management section, admins can select all the caching options available in your Magento 2.

In the arrow drop-down, please choose the Enable line and click the Submit button.

Enable Cache
Enable Cache

After that, you can recheck your frontend website if add to cart button reappears.

Magento 2 add to cart button stops working on the category page and the product page

To solve this problem, you could follow the two below steps. Firstly, kindly run the additional SQL lines.

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

Then, do not forget to delete the cache with the command.

rm -rf var/cache/*

If the add to cart button still does not work after trying these two above suggestions, you may contact your theme providers or the third-party extension builders because there may be other reasons which make this button not work.

The theme provider or third-party extension builder who has in-depth knowledge of their coding and module can fix the conflict issue faster and make the add to cart button work again.

Just a small note that it should differentiate between hiding add to cart button and the add to cart not working. Some store owners want to hide the add to cart button for some specific purposes. So customers need to contact them directly to negotiate the price. This is the intention of business doers.

They can hide the Add to Cart button on the Product Listing page and also the Product page. To make the Add to cart button not show on some specific pages, it required to install the third-party module, which helps hide the Add to cart button. Magento 2 default by itself does not have this functionality.

Hide Add to Cart button on Product Listing Page
Hide Add to Cart button on Product Listing Page
Hide Add to Cart button on Product Page
Hide Add to Cart button on Product Page

Conclusion

To sum up, the add to cart button is one of the most vital elements on every e-commerce store. Thus, business doers are afraid of any issue, which makes this button not working as they do not want this problem to affect their site performance. We hope that with two suggestions above can help store admins to solve this.

Looking for
Customization & Development Services?

8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.

Get free consultant
development service

Explore Our Products:

People also searched for

Subscribe

Stay in the know

Get special offers on the latest news from Mageplaza.

Earn $10 in reward now!

Earn $10 in reward now!

comment
iphone
go up