Home > WooCommerce > Docs > How to Fix Add to Cart Button Not Working in WooCommerce

How to Fix Add to Cart Button Not Working in WooCommerce

Last updated: April 01, 2024
This article has been written and researched by our expert Avada through a precise methodology. Learn more about our methodology

Sam

Author

Daniel

Researcher

Have you ever had a problem with the Add to Cart button not working in WooCommerce? However, you are at a loss as to what is causing the problem and how to resolve it. In certain situations, even if you have correctly configured your WooCommerce, you may still have problems when running your online business.

For a variety of reasons, the add to cart button does not work properly. In this tutorial, we will go through the most common causes of the add to cart button not working in WooCommerce, as well as how to solve them.

Now, let’s get started!

Common mistakes that cause Add to Cart button not working

We all know that WooCommerce is a large plugin with several functions that assist in the management of your online business. However, to expand its functionality, we often apply a lot of different supporting plugins. This will help your business stand out from the crowd. Anyway, you should be aware that the more tools you use and the more you customize your store, the more problems you may encounter.

Here are the common mistake that makes the Add to Cart button not working properly in WooCommerce:

  • Plugins and/or themes not updated
  • Compatibility issues with plugins or themes
  • Incomplete product information
  • Problem with WooCommerce status
  • Problem with the cache setup (server and plugin)
  • Flush the permalinks
  • Check out and Cart URLs
  • Ensure there are no problems at the checkout endpoints
  • Code-related issues with Add to Cart button
  • Add to Cart button issues related to themes

How to fix Add to Cart button not working in WooCommerce

With the ten most frequent mistakes listed above, we will try to provide you with a solution to each problem in the most understandable manner possible. But before you begin, please read the following note.

Note: To avoid data loss, we highly recommend you create a database backup of your WooCommerce if something goes wrong unexpectedly. Actually, we won’t make any big alternatives; backing up the database is merely a precaution. You can refer to how to backup WooCommerce database

Plugins and/or themes not updated

This is the most basic mistake and it’s also the simplest to correct. Before continuing with the debugging, you should check it and always be sure that WooCommerce is updated to the latest version.

Normally, The developers may release a new version to address compatibility issues and plugin conflicts, which are needed for your WooCommerce to work smoothly and continuously.

To do that, access the WordPress Dashboard, then go to Home > Update

example 1

Compatibility issues with plugins or themes

As previously stated, the more plugins you use, the more potential plugin and theme compatibility issues will occur. Simply follow these steps to see whether you’re having issues with a plugin or theme:

  1. Make sure that all plugins are updated to the latest version
  2. Clear the cache on your site
  3. Disable all the plugins one by one to find the one causing the problems using two steps below:
  4. Switch to the Storefront theme

If disabling the plugins resolves the issue, reactivate them one by one until you discover the problem. Besides, you should switch to the Storefront if the deactivation doesn’t work. A Storefront is a low-cost way for businesses to sell services or merchandise using a completely web-based system. It’s the default theme, and it works perfectly with WooCommerce and all of its features.

Incomplete product information

Incomplete product information is another important but frequently neglected result of the add to cart button not working. Please check that your product has all of the required information, including at least the product name and price. In addition, for other important information such as availability, product ID and product description, you should also fill it out.

example 3

Problem with WooCommerce status

To check WooCommerce’s status, going to WooCommerce > Status

Check each category such as WordPress, Server, Database, and so on to ensure no problems are indicated in the red line.

example 4

Problem with the cache setup (service and plugin)

Problems with your website caching your My Account, Cart, or Checkout pages may also create problems with your Add to Cart. Because these sites only hold dynamic content, you should always make sure that the URL for these pages is removed from your cache plugin. Therefore, you should use cache plugins to remove certain URLs.

If you’re unsure how to start, you’d better contact your server hosting provider and ask for assistance.

Permalinks are another reason why the add to cart button isn’t working properly, so that you better remove these links.

Go to WordPress Dashboard > Settings > Permalinks and save changes

If you want to update the settings to ensure that all permalinks are updated, click on any button in the Common Settings section and then click Save Changes.

After that, return to the previous setting and save the changes again.

example 6

Check out and Cart URLs

To verify whether or not your Checkout and Cart pages are set correctly, go to WooCommerce > Settings > Advanced and check under the Page Setup option including Cart page, Check out page, My Account page, and Terms and Conditions.

example 7

Ensure there are no problems at the checkout endpoints

Similar to the above errors, when the endpoints are not properly configured, the WooCommerce Add to Cart button may not work correctly.

To fix this problem, you also have access to WooCommerce > Setting > Advanced

example 8

Then, check under the Checkout endpoints option, including Pay, Order received, Add payment method, Delete payment method, Set default payment method. Make sure the endpoint URLs do not contain any spaces.

Code problems, particularly customized code, might also cause the add to cart button to fail to work. Moreover, if the add-to-cart button is not working, it might be due to pricing issues with your variable items. WooCommerce will typically disable the add-to-cart button in these cases.

In order to resolve this problem, go to Appearance > Theme Editor to open your functions.php file. Then, on the right sidebar, click on functions.php, add the following line of code at the end of the file in the editor, and click Update File. Then, double-check it.

Here is the code:


[add_filter('woocommerce_show_variation_price', function() {return TRUE;});]

example 9

In addition to the above reasons, the usage of the WooCommerce theme may be the reason for your Add to Cart button being hidden. The explanation for this is that it may have specific theme features for your product pages.

To check if this applies to you, go to Appearance > Customize > WooCommerce. Then, check the available options for the product page.

Furthermore, if there is a mismatch between your WordPress theme and your product page, or if the add to cart button isn’t loaded correctly due to template problems, you may correct it like this:

Access to Appearance > Theme Editor to open Theme File Editor. Then, on your right sidebar, click on Single Post under Theme files. At the end of the single.php file, paste the following code:


[if ( is_singular( 'product' ) ) {
wc_get_template_part( 'content', 'single-product' );
} else {
wc_get_template_part( 'content', 'single-product' );
}]

Note: If you have tried all of the above methods and they haven’t resolved your problem, you should contact your service provider and ask for assistance. Tell them about your problems and what you’ve done so far, since this will help them reject options and put them in the correct method more quickly.

Final words

In short, if the add to cart button does not work, it will have a negative impact on your store and create a bad consumer experience. In this post, we have listed ten common mistakes that can make your Add to Cart button not work properly and how to fix these mistakes.

Here are four key things to remember before finding the source of the problem to ensure that the fixing procedure is completed in the correct order.

  • Update WordPress, WooCommerce, and all of the plugins to the latest version
  • Clear the cache
  • Switch to Storefront theme
  • Deactivate all the plugins

Finally, we hope that if you are having problems with your Add to Cart button, you will find this article useful in solving the problem.

Don’t hesitate to leave a comment if you have any concerns! Thanks for reading!


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.

Stay in the know

Get special offers on the latest news from AVADA.