Hello, Woocommerce is a great CRM for an online store, but it does not have the option of hiding categories itself. That’s why I present a simple code (latest version, works with the new WP and WOO) which can hide any category for us.
We paste the code into the function.php file in our theme.
We also have a dedicated plugin for WordPress where you do not need to add categories to the code, we do everything from the WordPress administration panel.
You can buy it in out store!
<?php
add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );
function get_subcategory_terms( $terms, $taxonomies, $args ) {
$new_terms = array();
// if a product category and on the shop page
if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() ) {
foreach ( $terms as $key => $term ) {
if( is_object ( $term ) ) {
if ( ! in_array( $term->slug, array( 'cat_name', 'cat_name', 'cat_name', 'cat_name', 'cat_name' ... ) ) ) {
$new_terms[] = $term;
}
}
}
$terms = $new_terms;
}
return $terms;
}
?>