Merge pull request #14017 from woocommerce/fix/14008

Allow variation image to be unset
This commit is contained in:
Claudio Sanches 2017-04-06 10:12:12 -03:00 committed by GitHub
commit 03e05cab1c
1 changed files with 10 additions and 6 deletions

View File

@ -259,13 +259,17 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Products_Controller
}
// Thumbnail.
if ( isset( $request['image'] ) && is_array( $request['image'] ) ) {
$image = $request['image'];
if ( is_array( $image ) ) {
$image['position'] = 0;
}
if ( isset( $request['image'] ) ) {
if ( is_array( $request['image'] ) ) {
$image = $request['image'];
if ( is_array( $image ) ) {
$image['position'] = 0;
}
$variation = $this->set_product_images( $variation, array( $image ) );
$variation = $this->set_product_images( $variation, array( $image ) );
} else {
$variation->set_image_id( '' );
}
}
// Virtual variation.