Ecommerce Shopify WordPress Discussion

Woocommerce. How to hide some categories and subcategories on the shop main page, catalog pages (archive, categories and subcategories pages)

I need to hide (not disable, the category link should open as usual) certain categories in the list of categories and subcategories Woocommerce on the shop main page, catalog pages (archive, categories and subcategories pages): If there are no products in this category If all products in this category are Out of stock If all products in this category are Catalog visibility: Hidden I found a solution for this for the main store page, however, on the product category and archive counters, this solution completely removes all subcategories. function hide_empty_categories( $terms, $taxonomies, $args ) { $new_terms = array(); foreach ( $terms as $key => $term ) { if ( is_object( $term ) ) { if ( $term->count > 0 ) { $new_terms[] = $term; } } } return $new_terms; } add_filter( 'get_terms', 'hide_empty_categories', 10, 3 ); PS. There is no problem in the widget of categories and subcategories of products that are in the sidebar. There, the standard settings hide such categories, the problem is in the main place of displaying categories and subcategories Has anyone found the solution to set the product Catalog visibility: Hidden? How to use it in a way that it affected the categories (and not just the product)? I contacted Woocommerce support, where they told me that there are no standard solutions for this. I also tried to use different codes, the one given above, but it does not work correctly
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.