[REST API] Allow set grouped_products

Fixes #15559
This commit is contained in:
Claudio Sanches 2017-06-12 13:34:39 -03:00
parent 2541e38890
commit 43d28372b9
1 changed files with 5 additions and 1 deletions

View File

@ -994,6 +994,11 @@ class WC_REST_Products_Controller extends WC_REST_Legacy_Products_Controller {
$product = $this->save_default_attributes( $product, $request ); $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. // Check for featured/gallery images, upload it and set it.
if ( isset( $request['images'] ) ) { if ( isset( $request['images'] ) ) {
$product = $this->set_product_images( $product, $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', 'type' => 'integer',
), ),
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true,
), ),
'menu_order' => array( 'menu_order' => array(
'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ), 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ),