WC_Product_Data_Store_CPT::update_rating_counts()publicWC 3.0.0

Update a products rating counts.

Method of the class: WC_Product_Data_Store_CPT{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Product_Data_Store_CPT = new WC_Product_Data_Store_CPT();
$WC_Product_Data_Store_CPT->update_rating_counts( $product );
$product(WC_Product) (required)
Product object.

Changelog

Since 3.0.0 Introduced.

WC_Product_Data_Store_CPT::update_rating_counts() code WC 9.4.2

public function update_rating_counts( $product ) {
	update_post_meta( $product->get_id(), '_wc_rating_count', $product->get_rating_counts( 'edit' ) );
}