Variation level backorder 'parent' option makes no sense now parent backorder select is hidden

#6035
This commit is contained in:
Mike Jolley 2014-08-15 15:22:43 +01:00
parent d4fb1df412
commit 575ba5974e
2 changed files with 6 additions and 9 deletions

View File

@ -1535,11 +1535,7 @@ class WC_Meta_Box_Product_Data {
}
if ( 'yes' === $manage_stock ) {
if ( isset( $variable_backorders[ $i ] ) && $variable_backorders[ $i ] !== 'parent' ) {
update_post_meta( $variation_id, '_backorders', wc_clean( $variable_backorders[ $i ] ) );
} else {
delete_post_meta( $variation_id, '_backorders' );
}
update_post_meta( $variation_id, '_backorders', wc_clean( $variable_backorders[ $i ] ) );
wc_update_product_stock( $variation_id, wc_stock_amount( $variable_stock[ $i ] ) );
} else {
delete_post_meta( $variation_id, '_backorders' );

View File

@ -89,11 +89,12 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<td>
<label><?php _e( 'Allow Backorders?', 'woocommerce' ); ?></label>
<select name="variable_backorders[<?php echo $loop; ?>]">
<option value="parent" <?php selected( is_null( $_backorders ), true ); ?>><?php _e( 'Same as parent', 'woocommerce' ); ?></option>
<?php
foreach ( $parent_data['backorder_options'] as $key => $value )
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $key === $_backorders, true, false ) . '>' . esc_html( $value ) . '</option>';
?></select>
foreach ( $parent_data['backorder_options'] as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $key === $_backorders, true, false ) . '>' . esc_html( $value ) . '</option>';
}
?>
</select>
</td>
</tr>
<tr class="">