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.

{} It's a 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.

Code of WC_Comments::get_review_count_for_product() WC 6.7.0

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() ];
}