Make WooCommerce Product Not Purchasable [Guide]

Make a WooCommerce product not purchasable

Some products should stay visible in your catalog but never go into a cart. A discontinued item, a wholesale-only SKU, or a product sold only through a quote form all fall into this group. Shoppers should still see the product, but the Add to cart button has to go.

That’s what making a WooCommerce product not purchasable is for. Before allowing a purchase, WooCommerce asks each product whether it is purchasable, and one filter controls the answer. This guide shows the filter, three ways to target products, and how to test the result.

Use the woocommerce_is_purchasable Filter

WooCommerce runs the woocommerce_is_purchasable filter inside the product’s purchasable check and passes two arguments: the current boolean value and the product object. Return false and the product becomes non-purchasable. The Add to cart button disappears from the product page, and the cart refuses the item.

Disable Purchasing for All Products

The shortest version blocks every product on the site. Use it only on a staging site or when the whole store is catalog-only, because it also affects products you still want to sell.

<?php
add_filter( 'woocommerce_is_purchasable', '__return_false' );

Disable Purchasing for Specific Products

To block only some products, check the product ID and return the original value for everything else. Replace the sample IDs with your own.

<?php
add_filter( 'woocommerce_is_purchasable', 'my_disable_purchase_for_product_ids', 10, 2 );

function my_disable_purchase_for_product_ids( $purchasable, $product ) {
    $disabled_ids = array( 123, 456 );

    if ( in_array( $product->get_id(), $disabled_ids, true ) ) {
        return false;
    }

    return $purchasable;
}

[screenshot] Single product page for a blocked product, showing the price with no Add to cart button.

Disable Purchasing by Category or Tag

Listing IDs stops working once a catalog grows. Matching a category scales better, and the check below uses has_term(). Variations do not hold their own terms, so the code reads the parent product’s ID first.

<?php
add_filter( 'woocommerce_is_purchasable', 'my_disable_purchase_by_term', 10, 2 );

function my_disable_purchase_by_term( $purchasable, $product ) {
    $product_id = $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id();

    if ( has_term( array( 'digital-downloads', 'quote-only' ), 'product_cat', $product_id ) ) {
        return false;
    }

    return $purchasable;
}

Tip: To match tags instead of categories, change product_cat to product_tag and use tag slugs. The same parent ID check works for both.

Test the Change and Clear the Cache

Test in a private browser window, because logged-in admins and cached pages can both hide the result. Check these three things:

  • Product page: the Add to cart button is gone.
  • Shop archive: the product still appears, with no purchase button.
  • Direct add: a link with ?add-to-cart=ID does not put the item in the cart.

Purge any page cache after you save the code. A cached copy of the product page can show the old button until it expires.

FAQs About Making WooCommerce Products Not Purchasable

Where Do I Add This Code?

Put it in a site-specific plugin or your child theme’s functions.php. A plugin keeps working when the theme changes.

Will the Product Still Show in the Shop?

Yes. The product stays listed and viewable, but its purchase controls go away. To hide a product from the catalog completely, change its catalog visibility instead.

Does It Work for Variable Products?

Yes, when the check uses the parent ID, as in the category example. Without that check, each variation keeps its own Add to cart button.

Can I Make a Product Purchasable Again?

Yes. Remove the filter from your code, or return true for that product ID. The product goes back to normal purchase behavior.

Conclusion

The woocommerce_is_purchasable filter gives you one switch that covers the button, the cart, and the add-to-cart link. Start with a short list of product IDs, and move to term matching when the list grows.

If you need to limit what a cart can hold instead, read the WooCommerce allow 1 product in cart guide. Need rules like these built for your store? Hire a WooCommerce developer, or reach out to me directly.

About The Author

Picture of Andriy Haydash

Andriy Haydash

Andriy Haydash is a WordPress Expert who helps people build and launch successful WordPress membership and e-learning websites.

Note: Not all of the articles are written directly by me.
Affiliate Disclaimer: Some links in the post may be my affiliate links

Kinsta - Managed Hosting for WordPress

Before YOU Leave...
Join My Newsletter

Get practical tips & tricks on how to start, grow and market your course/membership site.