From 132c848b38103241a22952c4d227a620c9f645b0 Mon Sep 17 00:00:00 2001 From: kongper Date: Thu, 30 Jun 2016 14:38:41 +0200 Subject: [PATCH] Closes woothemes/woocommerce#11309 --- includes/api/class-wc-rest-products-controller.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/api/class-wc-rest-products-controller.php b/includes/api/class-wc-rest-products-controller.php index 7d970f3c4bd..6e4dd02ae11 100644 --- a/includes/api/class-wc-rest-products-controller.php +++ b/includes/api/class-wc-rest-products-controller.php @@ -1397,6 +1397,9 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller { wp_update_post( array( 'ID' => $attachment_id, 'post_title' => $image['name'] ) ); } + update_post_meta( $variation_id, '_thumbnail_id', $attachment_id ); + } elseif ( isset( $image['position'] ) && isset( $image['id'] ) && 0 < $image['id'] && 0 === $image['position'] ) { + $attachment_id = $image['id']; update_post_meta( $variation_id, '_thumbnail_id', $attachment_id ); } } else {