To hide a product category from your WooCommerce shop, add the following code to your functions.php file and replace xxxxxx with the slug of the category you want to hide:
function custom_pre_get_posts_query( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
if ( ! is_admin() && is_shop() ) {
$q->set( 'tax_query', array(array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'xxxxxx' ),
'operator' => 'NOT IN'
)));
}
remove_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
}
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );For more on WooCommerce categories, see Check if a Product Belongs to a Specific Category.