WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Widget_Rating_Filter::get_filtered_product_count() protected WC 1.0

Count products after other filters have occurred by adjusting the main query.

Это метод класса: WC_Widget_Rating_Filter{}

Хуков нет.

Возвращает

Число.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_filtered_product_count( $rating );
$rating(число) (обязательный)
Rating.

Код WC_Widget_Rating_Filter::get_filtered_product_count() WC 4.5.2

woocommerce/includes/widgets/class-wc-widget-rating-filter.php
<?php
protected function get_filtered_product_count( $rating ) {
	global $wpdb;

	$tax_query  = WC_Query::get_main_tax_query();
	$meta_query = WC_Query::get_main_meta_query();

	// Unset current rating filter.
	foreach ( $tax_query as $key => $query ) {
		if ( ! empty( $query['rating_filter'] ) ) {
			unset( $tax_query[ $key ] );
			break;
		}
	}

	// Set new rating filter.
	$product_visibility_terms = wc_get_product_visibility_term_ids();
	$tax_query[]              = array(
		'taxonomy'      => 'product_visibility',
		'field'         => 'term_taxonomy_id',
		'terms'         => $product_visibility_terms[ 'rated-' . $rating ],
		'operator'      => 'IN',
		'rating_filter' => true,
	);

	$meta_query     = new WP_Meta_Query( $meta_query );
	$tax_query      = new WP_Tax_Query( $tax_query );
	$meta_query_sql = $meta_query->get_sql( 'post', $wpdb->posts, 'ID' );
	$tax_query_sql  = $tax_query->get_sql( $wpdb->posts, 'ID' );

	$sql  = "SELECT COUNT( DISTINCT {$wpdb->posts}.ID ) FROM {$wpdb->posts} ";
	$sql .= $tax_query_sql['join'] . $meta_query_sql['join'];
	$sql .= " WHERE {$wpdb->posts}.post_type = 'product' AND {$wpdb->posts}.post_status = 'publish' ";
	$sql .= $tax_query_sql['where'] . $meta_query_sql['where'];

	$search = WC_Query::get_main_search_query_sql();
	if ( $search ) {
		$sql .= ' AND ' . $search;
	}

	return absint( $wpdb->get_var( $sql ) ); // WPCS: unprepared SQL ok.
}