Your product category and sub-category "In Ground Hoops" has the same term name but different term slugs for each:
- Product category "In Ground Hoops" term slug is:
'in-ground-hoops'
- Product sub-category "In Ground Hoops" term slug is:
'in-ground-hoops-goalrilla'
So the only way to distinguish both of them in the code is by their term ID or by their term slug. So I will use here the term Slug…
When looking at the responsible template that is displaying the meta output, the only way to filter that specific product subcategory is using the available WP get_the_terms
filter hook:
add_filter( 'get_the_terms', 'hide_specific_product_subcategory', 20, 3 );
function hide_specific_product_subcategory( $terms, $post_id, $taxonomy )
{
// Only on single product pages and for product category custom taxonomy
if( ! is_product() && $taxonomy != 'product_cat' ) return $terms; // We Exit
$category = 'in-ground-hoops'; // your main product category
$subcategory = 'in-ground-hoops-goalrilla'; // the related subcategory
$taxonomy = 'product_cat'; // product category taxonomy
if( has_term( $category, $taxonomy, $post_id ) ){
foreach ($terms as $key => $term){
if( $term->slug == $subcategory ){
unset( $terms[$key] );
}
}
}
return $terms;
}
Code goes in function.php file of your active child theme (or active theme).
Tested and works.