Fix product csv exporter get stock value
seems the original get stock value is wrong, but I'm not sure if my change is correct... what i'm considering is this line: if ( $product->is_type( 'variation' && 'parent' === $manage_stock ) ) {
This commit is contained in:
parent
1ef4aa10a0
commit
327fd26c70
|
@ -399,13 +399,17 @@ class WC_Product_CSV_Exporter extends WC_CSV_Batch_Exporter {
|
||||||
$manage_stock = $product->get_manage_stock( 'edit' );
|
$manage_stock = $product->get_manage_stock( 'edit' );
|
||||||
$stock_quantity = $product->get_stock_quantity( 'edit' );
|
$stock_quantity = $product->get_stock_quantity( 'edit' );
|
||||||
|
|
||||||
if ( $product->is_type( 'variation' && 'parent' === $manage_stock ) ) {
|
if ( $manage_stock ) {
|
||||||
return 'parent';
|
|
||||||
} elseif ( $manage_stock ) {
|
|
||||||
return $stock_quantity;
|
return $stock_quantity;
|
||||||
} else {
|
} else if ( $product->is_type( 'variation' ) ) {
|
||||||
return '';
|
if ( $product->get_parent_id( 'edit' ) ) {
|
||||||
|
$parent = wc_get_product( $product->get_parent_id( 'edit' ) );
|
||||||
|
if( $parent->get_manage_stock( 'edit' ) ) {
|
||||||
|
return 'parent';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue