WC_Product_CSV_Exporter::get_column_value_stock()
Get stock value.
Method of the class: WC_Product_CSV_Exporter{}
No Hooks.
Return
String
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_column_value_stock( $product );
- $product(WC_Product) (required)
- Product being exported.
Changelog
Since 3.1.0 | Introduced. |
WC_Product_CSV_Exporter::get_column_value_stock() WC Product CSV Exporter::get column value stock code WC 9.4.2
protected function get_column_value_stock( $product ) { $manage_stock = $product->get_manage_stock( 'edit' ); $stock_quantity = $product->get_stock_quantity( 'edit' ); if ( $product->is_type( 'variation' ) && 'parent' === $manage_stock ) { return 'parent'; } elseif ( $manage_stock ) { return $stock_quantity; } else { return ''; } }