WC_Product::get_cogs_value()publicWC 1.0

Get the defined value of the Cost of Goods Sold for this product. See set_cogs_value.

WARNING! If the Cost of Goods Sold feature is disabled this method will always return null.

Метод класса: WC_Product{}

Хуков нет.

Возвращает

float. The current value for this product.

Использование

$WC_Product = new WC_Product();
$WC_Product->get_cogs_value(): ?float;

Код WC_Product::get_cogs_value() WC 9.7.1

public function get_cogs_value(): ?float {
	if ( ! $this->cogs_is_enabled( __METHOD__ ) ) {
		return null;
	}

	$value = $this->get_prop( 'cogs_value' );
	return is_null( $value ) ? null : (float) $value;
}