WC_Product_Variation::get_manage_stock()publicWC 3.0.0

Return if product manage stock.

Method of the class: WC_Product_Variation{}

No Hooks.

Return

true|false|String. true, false, or parent.

Usage

$WC_Product_Variation = new WC_Product_Variation();
$WC_Product_Variation->get_manage_stock( $context );
$context(string)
What the value is for. Valid values are view and edit.
Default: 'view'

Changelog

Since 3.0.0 Introduced.

WC_Product_Variation::get_manage_stock() code WC 8.7.0

public function get_manage_stock( $context = 'view' ) {
	$value = $this->get_prop( 'manage_stock', $context );

	// Inherit value from parent.
	if ( 'view' === $context && false === $value && true === wc_string_to_bool( $this->parent_data['manage_stock'] ) ) {
		$value = 'parent';
	}
	return $value;
}