[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">';
// 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(
'step' => 'any'
) ) );
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'
),
'data_type' => 'stock'
) );
// Backorders?
woocommerce_wp_select( array( 'id' => '_backorders', 'label' => __( 'Allow Backorders?', 'woocommerce' ), 'options' => array(

View File

@ -35,11 +35,18 @@ function woocommerce_wp_text_input( $field ) {
case 'price' :
$field['class'] .= ' wc_input_price';
$field['value'] = wc_format_localized_price( $field['value'] );
break;
break;
case 'decimal' :
$field['class'] .= ' wc_input_decimal';
$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