Menafa
Menafa

Reputation: 1

Remove the Product Count on Woocommerce Categories

pic http://goo.gl/hnRfG9 I want to hide product count form category : I tried this in functions.php of theme

add_filter( 'woocommerce_subcategory_count_html', 'woo_remove_category_products_count' );
function woo_remove_category_products_count() {  
  return;  
}

But it does not work. I edit this from theme editor and also from directory to make sure its written.

Upvotes: 0

Views: 5831

Answers (4)

Snuffy
Snuffy

Reputation: 2096

To remove the count use this filter. This is official filter provided by woocommerce team - https://woocommerce.com/document/hide-sub-category-product-count-in-product-archives/

add_filter( 'woocommerce_subcategory_count_html', '__return_false' );

Add it in your functions.php file of your active theme.

Upvotes: 1

alextrejo
alextrejo

Reputation: 11

You can use the aforementioned filter, but you need to use the right arguments in your callback function:

add_filter('woocommerce_subcategory_count_html', function($html, $category){
  return '';
}, 2, 10);

Upvotes: 0

Paolo Euvrard
Paolo Euvrard

Reputation: 17

That one works for me:

add_filter( 'woocommerce_subcategory_count_html', 'jk_hide_category_count' );
function jk_hide_category_count() {
// No count
}

Picked it up in WooC tuts somewhere.

Upvotes: 1

Muhammad Februriyanto
Muhammad Februriyanto

Reputation: 79

Try this one:

/** Remove Showing results functionality site-wide */
function woocommerce_result_count() {
        return;
}

Upvotes: -1

Related Questions