Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hide Product Category Count in WooCommerce. If you want to hide product category count on the shop page, you only need to add this code to the bottom of your child theme’s functions.php file.
// Hide Product Category Count
add_filter( 'woocommerce_subcategory_count_html', 'prima_hide_subcategory_count' );
function prima_hide_subcategory_count() {
/* empty - no count */
}
@jarkokiliman

This comment has been minimized.

Copy link

@jarkokiliman jarkokiliman commented Nov 19, 2019

oooor, you can also do it easily with CSS.
Directly in code, or in your CMS (for example Wordpress) using 'Custom CSS'

/*doesn't show how many products are in a category */
.woocommerce-loop-category__title .count{
display: none !important;
}

;)

@bycassius

This comment has been minimized.

Copy link
Owner Author

@bycassius bycassius commented Nov 19, 2019

If you had suggested this back in 2013 (when that gist code was published) id have bought you a case of beer. Back in those days WooCommerce had teeth and real bad attitude.

@jappe66

This comment has been minimized.

Copy link

@jappe66 jappe66 commented Apr 6, 2020

The PHP function is a better solution than hiding the number with just CSS. Having unused code printed is not a good practice.
Both work for sure but it's always better to stop something from printing rather than hide it after it has been printed.

@tahacode4u

This comment has been minimized.

Copy link

@tahacode4u tahacode4u commented Aug 20, 2020

oooor, you can also do it easily with CSS.
Directly in code, or in your CMS (for example Wordpress) using 'Custom CSS'

/*doesn't show how many products are in a category */
.woocommerce-loop-category__title .count{
display: none !important;
}

;)

it's helped me for newby wp developer, thanks

@gostaffo

This comment has been minimized.

Copy link

@gostaffo gostaffo commented Jan 25, 2021

it's work in my page, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment