Woocommerce Remove Product Count

By default WooCommerce shows Product Count Numbers just next to the category name in WooCommerce categories list.

Sometimes that’s not something you want to show to your customers. You may have too much products and the huge number looks ugly, or you too little products and you don’t want to reveal that.

Sometimes it just doesn’t look right, especially if you are using a free theme with simple design. Frankly speaking, even with the default WooCommerce theme Storefront, things doesn’t look good with it’s yellow marking.

Woocommerce Categories Product Count

To make things even worse, on a store with a large inventory (hundreds and thousands of items) the product count can easily slow down your loading speed.

Today we are going to show you how to hide the Product Count Numbers with a single line code snippet.

Preparation

Before we start, make sure you have a child-theme prepared for your WordPress theme. If you’re an Althemist themes user, you can download a free starter child-theme here. You should never customize the code in your parent theme as this will be wiped entirely every time when you update it.

Alternatively, you may use a plugin like Code Snippets to insert the code.

PHP Function to Hide The Product Count

Luckily, WooCommerce offers a lot of handy hooks and filters, so you only need a single line of code in order to disable the categories product count.

/* --------------------------------------------------
 * Hide category product count in product archives *
 ------------------------------------------------- */

add_filter( 'woocommerce_subcategory_count_html', '__return_false' );

Where to Add the Code

The best place you can add the code would be at the bottom of your child-theme’s functions.php file.

Wrapping Up

Modifying basic WooCommerce features is pretty easy. However, If you are unfamiliar with code editing and resolving potential conflicts, we’d highly recommend to seek help from a qualified WordPress developer.

If you find this snippet helpful and used the custom WooCommerce function on your site, feel free to leave your thoughts in the comments area bellow.

About the Author:

Dimitar Koev is a graphic and web designer, front-end developer and marketing expert. CEO & founder of the Althemist team (previously known as Koev) - an independent envato market author, focused on building WordPress themes with strong e-commerce accent.

2 thoughts on “How to Hide Category Product Count in WooCommerce

  • AlthemistSeptember 9, 2019 at 9:31 am

    Hi John,

    Thanks for the feedback. We are glad it helped.

    Regards,
    Dimitar

    Reply
  • JohnSeptember 4, 2019 at 9:23 am

    Thank you.
    Worked perfectly for me on Woocommerce – Shopper Theme.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *