From 43d28372b9e5f8087ab3ee303b227c6cde95dc6a Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Mon, 12 Jun 2017 13:34:39 -0300 Subject: [PATCH] [REST API] Allow set grouped_products Fixes #15559 --- includes/api/class-wc-rest-products-controller.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/api/class-wc-rest-products-controller.php b/includes/api/class-wc-rest-products-controller.php index f0d39756ce0..dcdf19c0c21 100644 --- a/includes/api/class-wc-rest-products-controller.php +++ b/includes/api/class-wc-rest-products-controller.php @@ -994,6 +994,11 @@ class WC_REST_Products_Controller extends WC_REST_Legacy_Products_Controller { $product = $this->save_default_attributes( $product, $request ); } + // Check children for a grouped product. + if ( $product->is_type( 'grouped' ) && isset( $request['grouped_products'] ) ) { + $product->set_children( $request['grouped_products'] ); + } + // Check for featured/gallery images, upload it and set it. if ( isset( $request['images'] ) ) { $product = $this->set_product_images( $product, $request['images'] ); @@ -1925,7 +1930,6 @@ class WC_REST_Products_Controller extends WC_REST_Legacy_Products_Controller { 'type' => 'integer', ), 'context' => array( 'view', 'edit' ), - 'readonly' => true, ), 'menu_order' => array( 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ),