Website Building » WooCommerce » How Do I Hide the Add to Cart Button in WooCommerce?

How Do I Hide the Add to Cart Button in WooCommerce?

Last updated on January 17, 2023 @ 5:33 pm

There are a few ways to hide the add to cart button in WooCommerce. One way is to use the built-in settings to disable the button for certain products. Another way is to use a plugin or custom code snippets.

If you want to disable the add to cart button for specific products, you can do so under the product data tab in the product edit screen. Under the inventory tab, there is an option to disable the add to cart button.

If you want to hide the add to cart button sitewide, you can do so with a plugin or custom code snippet. For example, with the Code Snippets plugin, you can add this code to your child theme’s functions.php file:

add_filter( 'woocommerce_is_purchasable', '__return_false' );

With this code in place, the add to cart button will be hidden sitewide. If you only want to hide it on certain pages, you can use a conditional tag like this:

PRO TIP: If you are thinking about hiding the add to cart button in WooCommerce, be warned that this could have unintended consequences. For example, if you have a lot of products and use the hide add to cart button setting, your customers may get frustrated because they can’t add anything to their cart. Additionally, your store’s conversion rate could suffer because customers can’t add items to their cart and purchase them.
if ( is_product() ) {
remove_action( 
  'woocommerce_after_shop_loop_item', 
  'woocommerce_template_loop_add_to_cart' );
}

This code will hide the add to cart button on product pages only. You can adjust the conditional tag as needed to Target other pages.

There are a few ways to hide the add to cart button in WooCommerce.

With a little bit of customization, you can hide the add to cart button sitewide or on specific pages. This can be useful if you want to create a catalog-only site or if you’re selling products that require customization before purchase.

Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.