[2.2] fixed the value format in stock field with wc_stock_amount(), closes #6622

This commit is contained in:
claudiosmweb 2014-10-28 18:37:53 -02:00
parent 5405581ce4
commit a5ad428faf
2 changed files with 20 additions and 5 deletions

View File

@ -296,9 +296,17 @@ class WC_Meta_Box_Product_Data {
echo '<div class="stock_fields show_if_simple show_if_variable">'; echo '<div class="stock_fields show_if_simple show_if_variable">';
// Stock // Stock
woocommerce_wp_text_input( array( 'id' => '_stock', 'label' => __( 'Stock Qty', 'woocommerce' ), 'desc_tip' => true, 'description' => __( 'Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array( woocommerce_wp_text_input( array(
'id' => '_stock',
'label' => __( 'Stock Qty', 'woocommerce' ),
'desc_tip' => true,
'description' => __( 'Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'woocommerce' ),
'type' => 'number',
'custom_attributes' => array(
'step' => 'any' 'step' => 'any'
) ) ); ),
'data_type' => 'stock'
) );
// Backorders? // Backorders?
woocommerce_wp_select( array( 'id' => '_backorders', 'label' => __( 'Allow Backorders?', 'woocommerce' ), 'options' => array( woocommerce_wp_select( array( 'id' => '_backorders', 'label' => __( 'Allow Backorders?', 'woocommerce' ), 'options' => array(

View File

@ -40,6 +40,13 @@ function woocommerce_wp_text_input( $field ) {
$field['class'] .= ' wc_input_decimal'; $field['class'] .= ' wc_input_decimal';
$field['value'] = wc_format_localized_decimal( $field['value'] ); $field['value'] = wc_format_localized_decimal( $field['value'] );
break; break;
case 'stock' :
$field['class'] .= ' wc_input_stock';
$field['value'] = wc_stock_amount( $field['value'] );
break;
default :
break;
} }
// Custom attribute handling // Custom attribute handling