WC_Comments::get_review_count_for_product()public staticWC 3.0.0

Get product review count for a product (not replies). Please note this is not cached.

Method of the class: WC_Comments{}

No Hooks.

Return

Int.

Usage

$result = WC_Comments::get_review_count_for_product( $product );
$product(WC_Product) (required) (passed by reference — &)
Product instance.

Changelog

Since 3.0.0 Introduced.

WC_Comments::get_review_count_for_product() code WC 9.4.2

public static function get_review_count_for_product( &$product ) {
	$counts = self::get_review_counts_for_product_ids( array( $product->get_id() ) );

	return $counts[ $product->get_id() ];
}