WordPress at Your Fingertips
function is not described

WC_Product_CSV_Exporter::get_column_value_stock() protected WC 3.1.0

Get stock value.

{} It's a 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.

Code of WC_Product_CSV_Exporter::get_column_value_stock() WC 5.9.0

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 '';
	}
}