sync_rating_count before average in deprecated method

This commit is contained in:
Mike Jolley 2019-03-05 13:47:56 +00:00
parent a2606a3f1f
commit 6d5f5be164
1 changed files with 1 additions and 0 deletions

View File

@ -653,6 +653,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
*/
public static function sync_average_rating( $post_id ) {
wc_deprecated_function( 'WC_Product::sync_average_rating', '3.0', 'WC_Comments::get_average_rating_for_product or leave to CRUD.' );
self::sync_rating_count( $post_id );
$average = WC_Comments::get_average_rating_for_product( wc_get_product( $post_id ) );
update_post_meta( $post_id, '_wc_average_rating', $average );
}