Hide Category
-
I want to the hide the category under the each products, right now it shows the city for example.
Is there some sort of css code I can use to hide the category label?
The page I need help with: [log in to see the link]
-
Hello,
Please add the below code in the active theme functions.php file
these codes hide particular categories from the shop page. if you want to hide all categories then please add all categories id.
function get_subcategory_terms( $terms, $taxonomies, $args ) { $new_terms = array(); $hide_category = array( 126 ); // Ids of the category you don't want to display on the shop page // if a product category and on the shop page if ( in_array( 'product_cat', $taxonomies ) && !is_admin() && is_shop() ) foreach ( $terms as $key => $term ) { if ( ! in_array( $term->term_id, $hide_category ) ) { $new_terms[] = $term; } } $terms = $new_terms; } return $terms; } add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );if you want to hide categories in product page then please add the below code in the active theme functions.php file
/* Remove Categories from Single Products */ remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );or you can also hide categories using css in product page.
.product_meta .posted_in {display: none !important;}I hope it will help you
Hi there,
Excellent answer @aimsinfosofts, nothing to add! 😉
Hey it didnt work, im trying hide the product category when using the product widget on a certain page
When checking your site it seems that this is where the category is displayed: https://d.pr/i/NKs5mj
if so, you can hide with this CSS snippet:
.woocommerce ul.products li.product li.category { display: none; }To be added via the Appearance > Customize > Additional CSS menu item
Thank you very much
You’re welcome!
The topic ‘Hide Category’ is closed to new replies.