updated import/export functions for low_stock_amount

This commit is contained in:
Joey 2018-05-27 06:00:20 +01:00
parent 5f36ba44cd
commit d815f7bad5
3 changed files with 13 additions and 2 deletions

View File

@ -475,6 +475,7 @@ class WC_Product_CSV_Importer_Controller {
__( 'In stock?', 'woocommerce' ) => 'stock_status',
__( 'Stock', 'woocommerce' ) => 'stock_quantity',
__( 'Backorders allowed?', 'woocommerce' ) => 'backorders',
__( 'Low stock amount', 'woocommerce' ) => 'low_stock_amount',
__( 'Sold individually?', 'woocommerce' ) => 'sold_individually',
/* translators: %s: Weight unit */
sprintf( __( 'Weight (%s)', 'woocommerce' ), $weight_unit ) => 'weight',
@ -640,7 +641,7 @@ class WC_Product_CSV_Importer_Controller {
'stock_status' => __( 'In stock?', 'woocommerce' ),
'stock_quantity' => _x( 'Stock', 'Quantity in stock', 'woocommerce' ),
'backorders' => __( 'Backorders allowed?', 'woocommerce' ),
'low_stock_amount' => __( 'Low Stock Amount', 'woocommerce' ),
'low_stock_amount' => __( 'Low stock amount', 'woocommerce' ),
'sold_individually' => __( 'Sold individually?', 'woocommerce' ),
/* translators: %s: weight unit */
'weight' => sprintf( __( 'Weight (%s)', 'woocommerce' ), $weight_unit ),

View File

@ -55,7 +55,7 @@ function wc_importer_default_english_mappings( $mappings ) {
'In stock?' => 'stock_status',
'Stock' => 'stock_quantity',
'Backorders allowed?' => 'backorders',
'Low Stock Amount' => 'low_stock_amount',
'Low stock amount' => 'low_stock_amount',
'Sold individually?' => 'sold_individually',
sprintf( 'Weight (%s)', $weight_unit ) => 'weight',
sprintf( 'Length (%s)', $dimension_unit ) => 'length',

View File

@ -444,6 +444,16 @@ class WC_Product_CSV_Exporter extends WC_CSV_Batch_Exporter {
}
}
/**
* Get low stock amount value.
*
* @param WC_Product $product Product being exported.
* @return string
*/
protected function get_column_value_low_stock_amount( $product ) {
return $product->managing_stock() && $product->get_low_stock_amount( 'edit' ) ? $product->get_low_stock_amount( 'edit' ) : '';
}
/**
* Get type value.
*