WC_Product_CSV_Exporter::get_column_value_stock( WC_Product $product )

Get stock value.


Description Description


Parameters Parameters

$product

(Required) Product being exported.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/export/class-wc-product-csv-exporter.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
3.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.