[REST API] Handle variation image as object and not array

This commit is contained in:
Claudio Sanches 2017-03-23 00:38:52 -03:00
parent 8efb45312d
commit 5a85e6a6f8
1 changed files with 1 additions and 2 deletions

View File

@ -192,7 +192,7 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Products_Controller
),
'shipping_class' => $object->get_shipping_class(),
'shipping_class_id' => $object->get_shipping_class_id(),
'image' => $this->get_images( $object ),
'image' => current( $this->get_images( $object ) ),
'attributes' => $this->get_attributes( $object ),
'menu_order' => $object->get_menu_order(),
'meta_data' => $object->get_meta_data(),
@ -261,7 +261,6 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Products_Controller
// Thumbnail.
if ( isset( $request['image'] ) && is_array( $request['image'] ) ) {
$image = $request['image'];
$image = current( $image );
if ( is_array( $image ) ) {
$image['position'] = 0;
}