WooCommerce, by default, shows the product count of the subcategories on category pages. This can clutter the page, especially if there are many subcategories. In this guide, we will show how to remove the product count of subcategories, thereby improving the user experience by reducing distractions.
The image below represents the default behavior of showing the product count of subcategories before the code was implemented.
Solution: Remove the Product Count for Subcategories
The code will remove the product count of subcategories and thus makes the categories page look cleaner.
add_filter( 'woocommerce_subcategory_count_html', '__return_null' );
Output
After implementing the code, the product count for subcategories will no longer be visible on the category page.
If you want to improve your category pages, there are other similar customizations you can try out. For example, you could add a special offer or a promotional message that shows up on all your category pages. By using a code snippet, you can add the category description text in WooCommerce to ensure this message is visible across every category, making it easier to share important offers with your customers.