[2.4] [API] Fixed backorders edit for variations

closes #9618
This commit is contained in:
Claudio Sanches 2015-12-01 19:14:41 -02:00
parent 89d177a48b
commit c68501f666
2 changed files with 6 additions and 6 deletions

View File

@ -1807,17 +1807,17 @@ class WC_API_Products extends WC_API_Resource {
}
if ( 'yes' === $managing_stock ) {
$backorders = get_post_meta( $variation_id, '_backorders', true );
if ( isset( $variation['backorders'] ) ) {
if ( 'notify' == $variation['backorders'] ) {
$backorders = 'notify';
} else {
$backorders = ( true === $variation['backorders'] ) ? 'yes' : 'no';
}
} else {
$backorders = 'no';
}
update_post_meta( $variation_id, '_backorders', $backorders );
update_post_meta( $variation_id, '_backorders', '' === $backorders ? 'no' : $backorders );
if ( isset( $variation['stock_quantity'] ) ) {
wc_update_product_stock( $variation_id, wc_stock_amount( $variation['stock_quantity'] ) );

View File

@ -1349,17 +1349,17 @@ class WC_API_Products extends WC_API_Resource {
}
if ( 'yes' === $managing_stock ) {
$backorders = get_post_meta( $variation_id, '_backorders', true );
if ( isset( $variation['backorders'] ) ) {
if ( 'notify' == $variation['backorders'] ) {
$backorders = 'notify';
} else {
$backorders = ( true === $variation['backorders'] ) ? 'yes' : 'no';
}
} else {
$backorders = 'no';
}
update_post_meta( $variation_id, '_backorders', $backorders );
update_post_meta( $variation_id, '_backorders', '' === $backorders ? 'no' : $backorders );
if ( isset( $variation['stock_quantity'] ) ) {
wc_update_product_stock( $variation_id, wc_stock_amount( $variation['stock_quantity'] ) );