woocommerce_layered_nav_count

The WooCommerce woocommerce layered nav count hook.

Description

apply_filters( 'woocommerce_layered_nav_count', (string) $span_class_count_absint_count_span, (number) $count, (unknown) $term ); 

Parameters (3)

0. $span_class_count_absint_count_span — Optional. (string) => '(' . absint( $count ) . ')'
The span class count absint count span.
1. $count (number)
The count.
2. $term (unknown)
The term.

Usage

To run the hook, copy the example below.
  1. $span_class_count_absint_count_span = apply_filters( 'woocommerce_layered_nav_count', $span_class_count_absint_count_span, $count, $term ); 
  2.  
  3. if ( !empty( $span_class_count_absint_count_span ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_layered_nav_count callback 
  2. function filter_woocommerce_layered_nav_count( $span_class_count_absint_count_span, $count, $term ) { 
  3. // make filter magic happen here... 
  4. return $span_class_count_absint_count_span
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_layered_nav_count', 'filter_woocommerce_layered_nav_count', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_layered_nav_count', 'filter_woocommerce_layered_nav_count', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/widgets/class-wc-widget-layered-nav.php  
  1. $term_html .= ' ' . apply_filters( 'woocommerce_layered_nav_count', '<span class="count">(' . absint( $count ) . ')</span>', $count, $term );