Add average rating to the products API response

This commit is contained in:
Kelly Dwan 2019-03-05 16:53:29 -05:00
parent f42c88f4f3
commit b360643582
1 changed files with 2 additions and 0 deletions

View File

@ -301,6 +301,7 @@ class WC_REST_Blocks_Products_Controller extends WC_REST_Products_Controller {
$data['price'] = $raw_data['price'];
$data['price_html'] = $raw_data['price_html'];
$data['images'] = $raw_data['images'];
$data['average_rating'] = $raw_data['average_rating'];
return $data;
}
@ -364,6 +365,7 @@ class WC_REST_Blocks_Products_Controller extends WC_REST_Products_Controller {
$schema['properties']['short_description'] = $raw_schema['properties']['short_description'];
$schema['properties']['price'] = $raw_schema['properties']['price'];
$schema['properties']['price_html'] = $raw_schema['properties']['price_html'];
$schema['properties']['average_rating'] = $raw_schema['properties']['average_rating'];
$schema['properties']['images'] = array(
'description' => $raw_schema['properties']['images']['description'],
'type' => 'object',