Make Products Non-Purchasable
When you would like to turn your WooCommerce shop into a catalog for example, there could be different options how to do it. Or maybe you would like to make non-purchasable just some specific products – I don’t know, but I hope this tutorial will cover everything.
In the first chapter I will show how you can do it just in your WooCommerce admin, but then we will dive deep into using woocommerce_is_purchasable
filter hook and then play with some conditions.
It is worth mentioning that the ways described here are the most correct ones, because, if let’s say, you just removed “Add to Cart” button (I hope not with CSS at least), the products will still be available for purchase in some way.
If at the moment of integrating these methods into a website, customers have any of the non-purchasable products in their carts, the products will be immediately removed.
Okay, let’s do something.
The easiest way to prevent a product from being purchased is to remove its price. Not to set it to 0
, but to empty the price field completely, like this:

Once you do that, your product will be displayed like this, completely unavailable for purchase.

Another option is to go to Inventory tab and set the product stock status to “Out of stock” or stock quantity to 0
.

Ok, as I already mentioned before, it works great on a per product basis, but what if you would like to turn your WooCommerce store into a catalog and completely disable purchasing any product?
woocommerce_is_purchasable
As simple as to insert the below code into your functions.php
file, you can completely disable purchasing all the products on your WooCommerce website.
/**
* Make all WooCommerce products non-purchasable
*
* @author Misha Rudrastyh
* @url https://rudrastyh.com/woocommerce/make-products-non-purchasable.html#woocommerce_is_purchasable
*/
add_filter( 'woocommerce_is_purchasable', 'misha_catalog_mode_on' );
function misha_catalog_mode_on( $is_purchasable ) {
$is_purchasable = false;
return $is_purchasable;
}
Actually this filter hook can be written just in a single line of code, but I wanted to keep things clear for you. So, here is how:
add_filter( 'woocommerce_is_purchasable', '__return_false' );
The next thing I want to show you is how you can use woocommerce_is_purchasable
filter hook for products in specific product categories or even for products with certain IDs. Ok, let’s play with some conditions now.
For specific product IDs
/**
* Make specific WooCommerce products non-purchasable
*
* @author Misha Rudrastyh
* @url https://rudrastyh.com/woocommerce/make-products-non-purchasable.html#specific-products
*/
add_filter( 'woocommerce_is_purchasable', 'misha_catalog_mode_on_for_product', 10, 2 );
function misha_catalog_mode_on_for_product( $is_purchasable, $product ) {
$not_purchasable_products = array( 123, 45, 789 );
if( in_array( $product->get_id(), $not_purchasable_products ) ) {
$is_purchasable = false;
}
return $is_purchasable;
}
You can pass as many product IDs as you want in $not_purchasable_products
variable.
For specific product categories or product tags
/*
* Disable buying products from specific category and tag
*
* @author Misha Rudrastyh
* @url https://rudrastyh.com/woocommerce/make-products-non-purchasable.html#specific-categories
*/
add_filter( 'woocommerce_is_purchasable', 'misha_catalog_mode_on_for_category', 10, 2 );
function misha_catalog_mode_on_for_category( $is_purchasable, $product ) {
// First – check product categories
if( has_term( 'uncategorized', 'product_cat', $product->get_id() ) ) {
$is_purchasable = false;
}
// Second – check product tags
if( has_term( 'newyearsale', 'product_tag', $product->get_id() ) ) {
$is_purchasable = false;
}
return $is_purchasable;
}
You can find more examples of has_term()
usage in this tutorial.

Misha Rudrastyh
Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.
Need some developer help? Contact me
How would you do this conditionally based on a meta field? We gave a meta field for the prouduct called IsCancelled and its value can be yes or no. How would we set this up to remove Is Purchase if and only if the field value is yes?
I had previous added
add_filter( 'woocommerce_is_purchasable', '__return_false');
and it was working correctly, making all products unpurchaseable. Not it seems in the most recent version of WooCommerce, it doesn’t work.Is it just me?
Hey Ben,
For me it works 🙃
It might be that another plugin/theme/snippet is overriding yours.
https://developer.wordpress.org/reference/functions/add_filter/
add_filter( string $hook_name, callable $callback, int $priority = 10)
You can try to make the priority higher, eg.
add_filter( 'woocommerce_is_purchasable', '__return_false', 999);
Hi Misha,
I’m always trilled when people share their knowledge on a certain area. I was looking for a solution and your tutorial helped me out. Thank you!
Hi Brecht,
Wow, I am happy to help! ⚡️
Misha, thank You very much for this. I tried few solutions but they did not work. I finally made it with You code. Best regards.
Misha, thank you so much for this. I tried the code to remove by tag/category and it works like a charm!
In the variable product you have a bracket missing:
if( in_array( $product->get_id(), $not_purchasable_products ) {
Thanks! fixed
hello! this only worked in the store page for me, not at the product page. any thoughts? i used the removable by product id