Pegue este código en function.php:
add_action( 'count_product_title', 'add_product_count_view', 10);
function add_product_count_view() {
global $wp_query;
$category_id = $wp_query->get_queried_object()->term_id;
//echo sprintf( _n( '%d товар', '%d товаров', $term->count ), $term->count );
$query = new WP_Query( array(
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => $category_id,
'include_children' => true,
),
),
'nopaging' => true,
'fields' => 'ids',
) );
if( function_exists("is_shop") && $category_id != 0) {
echo '(' .esc_html( $query->post_count ) . ')';
}
}
Pega en tu plantilla
<?php do_action('count_product_title');?>
.