From b3606435825f50ecbedad7d247ccb7c02f3b1c54 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Tue, 5 Mar 2019 16:53:29 -0500 Subject: [PATCH] Add average rating to the products API response --- .../api/wc-blocks/class-wc-rest-blocks-products-controller.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/api/wc-blocks/class-wc-rest-blocks-products-controller.php b/includes/api/wc-blocks/class-wc-rest-blocks-products-controller.php index ac6c8e41f84..ac8e496ee41 100644 --- a/includes/api/wc-blocks/class-wc-rest-blocks-products-controller.php +++ b/includes/api/wc-blocks/class-wc-rest-blocks-products-controller.php @@ -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',