WC_Product::get_rating_count()publicWC 1.0

Get the total amount (COUNT) of ratings, or just the count for one rating e.g. number of 5 star ratings.

Метод класса: WC_Product{}

Хуков нет.

Возвращает

int.

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

$WC_Product = new WC_Product();
$WC_Product->get_rating_count( $value );
$value(int)
Rating value to get the count for. By default returns the count of all rating values.
По умолчанию: null

Код WC_Product::get_rating_count() WC 8.7.0

public function get_rating_count( $value = null ) {
	$counts = $this->get_rating_counts();

	if ( is_null( $value ) ) {
		return array_sum( $counts );
	} elseif ( isset( $counts[ $value ] ) ) {
		return absint( $counts[ $value ] );
	} else {
		return 0;
	}
}