Product Archive, Product Page

WooCommerce Make Products Non-Purchasable For A Specific Category

WooCommerce category without add to cart button


There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About This Solution

This snippet allows you to make all products from a specific category non-purchasable. This means the user is unable to buy the product. The ‘add to cart’ button is removed and the ability to add products to the cart is disabled via add to cart URLs.

 * Snippet Name:	WooCommerce Make Products Non-Purchasable For A Specific Category
 * Snippet Author:

add_filter('woocommerce_is_purchasable', 'ecommercehints_catalog_mode_for_specific_category', 10, 2 );

function ecommercehints_catalog_mode_for_specific_category( $is_purchasable, $product ) {
	if (has_term('accessories', 'product_cat', $product->get_id())) { // Change 'accessories' to the category slug you would like non-purchasable
		return false;
	return $is_purchasable;

Snippet Benefits

  • Only allow customers to buy products from a specific category.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.