Merge pull request #11310 from kongper/master
Add variation image by attachment_id #11309
This commit is contained in:
commit
746157557a
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue