@@ 1116-1121 (lines=6) @@ | ||
1113 | // Stock data. |
|
1114 | if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) { |
|
1115 | // Manage stock. |
|
1116 | if ( isset( $request['manage_stock'] ) ) { |
|
1117 | $manage_stock = ( true === $request['manage_stock'] ) ? 'yes' : 'no'; |
|
1118 | update_post_meta( $product->id, '_manage_stock', $manage_stock ); |
|
1119 | } else { |
|
1120 | $manage_stock = get_post_meta( $product->id, '_manage_stock', true ); |
|
1121 | } |
|
1122 | ||
1123 | // Backorders. |
|
1124 | if ( isset( $request['backorders'] ) ) { |
|
@@ 1219-1224 (lines=6) @@ | ||
1216 | } |
|
1217 | ||
1218 | // Downloadable. |
|
1219 | if ( isset( $request['downloadable'] ) ) { |
|
1220 | $is_downloadable = true === $request['downloadable'] ? 'yes' : 'no'; |
|
1221 | update_post_meta( $product->id, '_downloadable', $is_downloadable ); |
|
1222 | } else { |
|
1223 | $is_downloadable = get_post_meta( $product->id, '_downloadable', true ); |
|
1224 | } |
|
1225 | ||
1226 | // Downloadable options. |
|
1227 | if ( 'yes' === $is_downloadable ) { |
|
@@ 1376-1381 (lines=6) @@ | ||
1373 | } |
|
1374 | ||
1375 | // Downloadable variation. |
|
1376 | if ( isset( $variation['downloadable'] ) ) { |
|
1377 | $is_downloadable = ( true === $variation['downloadable'] ) ? 'yes' : 'no'; |
|
1378 | update_post_meta( $variation_id, '_downloadable', $is_downloadable ); |
|
1379 | } else { |
|
1380 | $is_downloadable = get_post_meta( $variation_id, '_downloadable', true ); |
|
1381 | } |
|
1382 | ||
1383 | // Shipping data. |
|
1384 | $this->save_product_shipping_data( $variation_id, $variation ); |
@@ 1354-1359 (lines=6) @@ | ||
1351 | // Stock Data |
|
1352 | if ( 'yes' == get_option( 'woocommerce_manage_stock' ) ) { |
|
1353 | // Manage stock |
|
1354 | if ( isset( $data['managing_stock'] ) ) { |
|
1355 | $managing_stock = ( $this->is_true( $data['managing_stock'] ) ) ? 'yes' : 'no'; |
|
1356 | update_post_meta( $product_id, '_manage_stock', $managing_stock ); |
|
1357 | } else { |
|
1358 | $managing_stock = get_post_meta( $product_id, '_manage_stock', true ); |
|
1359 | } |
|
1360 | ||
1361 | // Backorders |
|
1362 | if ( isset( $data['backorders'] ) ) { |
|
@@ 1462-1467 (lines=6) @@ | ||
1459 | } |
|
1460 | ||
1461 | // Downloadable |
|
1462 | if ( isset( $data['downloadable'] ) ) { |
|
1463 | $is_downloadable = ( $this->is_true( $data['downloadable'] ) ) ? 'yes' : 'no'; |
|
1464 | update_post_meta( $product_id, '_downloadable', $is_downloadable ); |
|
1465 | } else { |
|
1466 | $is_downloadable = get_post_meta( $product_id, '_downloadable', true ); |
|
1467 | } |
|
1468 | ||
1469 | // Downloadable options |
|
1470 | if ( 'yes' == $is_downloadable ) { |
|
@@ 1617-1622 (lines=6) @@ | ||
1614 | } |
|
1615 | ||
1616 | // Downloadable variation |
|
1617 | if ( isset( $variation['downloadable'] ) ) { |
|
1618 | $is_downloadable = ( $this->is_true( $variation['downloadable'] ) ) ? 'yes' : 'no'; |
|
1619 | update_post_meta( $variation_id, '_downloadable', $is_downloadable ); |
|
1620 | } else { |
|
1621 | $is_downloadable = get_post_meta( $variation_id, '_downloadable', true ); |
|
1622 | } |
|
1623 | ||
1624 | // Shipping data |
|
1625 | $this->save_product_shipping_data( $variation_id, $variation ); |
|
@@ 1628-1633 (lines=6) @@ | ||
1625 | $this->save_product_shipping_data( $variation_id, $variation ); |
|
1626 | ||
1627 | // Stock handling |
|
1628 | if ( isset( $variation['managing_stock'] ) ) { |
|
1629 | $managing_stock = ( $this->is_true( $variation['managing_stock'] ) ) ? 'yes' : 'no'; |
|
1630 | update_post_meta( $variation_id, '_manage_stock', $managing_stock ); |
|
1631 | } else { |
|
1632 | $managing_stock = get_post_meta( $variation_id, '_manage_stock', true ); |
|
1633 | } |
|
1634 | ||
1635 | // Only update stock status to user setting if changed by the user, but do so before looking at stock levels at variation level |
|
1636 | if ( isset( $variation['in_stock'] ) ) { |