Merge pull request #11310 from kongper/master

Add variation image by attachment_id #11309
This commit is contained in:
Claudio Sanches 2016-06-30 12:43:47 -03:00 committed by GitHub
commit 746157557a
1 changed files with 3 additions and 0 deletions

View File

@ -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 {