Merge pull request #13981 from woocommerce/fix/13936

[REST API] Fixed attributes while trying to save variations
This commit is contained in:
Claudio Sanches 2017-04-06 11:38:23 -03:00 committed by GitHub
commit f3156fb5f4
2 changed files with 2 additions and 3 deletions

View File

@ -1262,7 +1262,7 @@ class WC_API_Products extends WC_API_Resource {
global $wpdb;
$id = $product->get_id();
$attributes = $product->get_variation_attributes();
$attributes = $product->get_attributes();
foreach ( $request['variations'] as $menu_order => $data ) {
$variation_id = isset( $data['id'] ) ? absint( $data['id'] ) : 0;

View File

@ -1751,8 +1751,7 @@ class WC_API_Products extends WC_API_Resource {
global $wpdb;
$id = $product->get_id();
$variations = $request['variations'];
$attributes = (array) get_post_meta( $id, '_product_attributes', true );
$attributes = $product->get_attributes();
foreach ( $variations as $menu_order => $data ) {
$variation_id = isset( $data['id'] ) ? absint( $data['id'] ) : 0;