Easily remove the Category count number on WooCommerce pages

See how to easily remove the number showing how many products are in each category using PHP and/or CSS.
StoreCustomizer - Remove the Category Count on WooCommerce Categories

When setting up your WooCommerce shop page, you have the option to display only the WooCommerce products, WooCommerce categories, or products and categories on your WooCommerce shop page.

When displaying the WooCommerce categories, there is a number displayed on each category showing how many products are in each category, if your WordPress theme doesn’t style this to look better than the default then it usually displays as a number with a yellow background.

In this article we’ll show you how to remove the category count number completely, or to add some custom styling to display it better for your shop customers.

These code snippets are to be added to your child theme functions.php file, or to a Site Customizations plugin so that you do not lose your changes when you update your WordPress theme.

Remove the category count number everywhere:

To completely remove the category count number, you can simply copy the following PHP code and add it to your site.

// Remove the category count for WooCommerce categories
add_filter( 'woocommerce_subcategory_count_html', '__return_null' );

And to remove the category count for WooCommerce categories using CSS you can add the following code to Customize -> Additional CSS:

.woocommerce-loop-category__title mark.count {
    display: none;

Add custom CSS to style the category count to look better:

If you’re wanting the category product count to stay on the categories, but you want it to look better and not have a yellow background then you can add the following custom CSS to Customize -> Additional CSS.

If you know a little more about CSS then you can add more attributes to style it as you want, otherwise, this CSS will make it smaller and lighter so it fits most theme designs and look neater.

.woocommerce-loop-category__title mark.count {
    background: none;
    font-size: 0.8em;
    color: #000;
    opacity: 0.4;
    letter-spacing: 1px;

Our StoreCustomizer plugin offers these code snippets all built into the WordPress Customizer to easily remove the WooCommerce category count from the shop pages that are displaying categories.