WC_Product::get_rating_count()
Get the total amount (COUNT) of ratings, or just the count for one rating e.g. number of 5 star ratings.
Method of the class: WC_Product{}
No Hooks.
Return
Int
.
Usage
$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.
Default: null
WC_Product::get_rating_count() WC Product::get rating count code WC 8.6.1
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; } }