Hide Specific Product Category in WooCommerce

I don't mind admitting I've avoided Wordpress like the plague for years. Mostly because, as a very junior developer, I was asked to fix a site which had been compromised. It was an absolute mess and it put me off using Wordpress for for the following decade.

But, with new clients come new responsibilities. And, in this case, a bunch of Wordpress and WooCommerce websites. So I'm learning a few things, which I guess is the upside of adopting a new platform.

Here's a quick snippet which you can add to your theme's functions.php page. This will allow you to hide a specific product category. Just swap [category-slug] for your product category slug and it'll be removed from the default category list.

add_filter( 'get_terms', 'ts_get_subcategory_terms', 10, 3 );
function ts_get_subcategory_terms( $terms, $taxonomies, $args ) {
  $new_terms = array();
  if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() &&is_shop() ) {
      foreach( $terms as $key => $term ) {
          if ( !in_array( $term->slug, array( '[category-slug]' ) ) ) {
              $new_terms[] = $term;
      $terms = $new_terms;
  return $terms;

You’ve reached the end of this page. Get more ideas delivered to your inbox.

If you’d like ideas straight to your inbox, sign up below. I don’t send out many emails, and you can unsubscribe at any time.