Add rating_count to lookup table

This commit is contained in:
Mike Jolley 2019-03-06 14:03:44 +00:00
parent b07f3e21db
commit a697c97472
2 changed files with 2 additions and 0 deletions

View File

@ -827,6 +827,7 @@ CREATE TABLE {$wpdb->prefix}wc_product_meta_lookup (
`product_id` bigint(20) NOT NULL,
`min_price` decimal(10,2) NULL default NULL,
`max_price` decimal(10,2) NULL default NULL,
`rating_count` bigint(20) NULL default 0,
`average_rating` decimal(3,2) NULL default 0.00,
`total_sales` bigint(20) NULL default 0,
`stock` bigint(20) NULL default NULL,

View File

@ -1883,6 +1883,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
'product_id' => absint( $id ),
'min_price' => reset( $price_meta ),
'max_price' => end( $price_meta ),
'rating_count' => array_sum( (array) get_post_meta( $id, '_wc_rating_count', true ) ),
'average_rating' => get_post_meta( $id, '_wc_average_rating', true ),
'total_sales' => get_post_meta( $id, 'total_sales', true ),
'stock' => $stock,