WC_Order_Item::get_cogs_value()publicWC 1.0

Get the value of the Cost of Goods Sold for this order item.

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

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

Хуков нет.

Возвращает

float. The current value for this order item.

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

$WC_Order_Item = new WC_Order_Item();
$WC_Order_Item->get_cogs_value( $context ): float;
$context(строка)
What the value is for. Valid values are view and edit.
По умолчанию: 'view'

Код WC_Order_Item::get_cogs_value() WC 9.6.1

public function get_cogs_value( $context = 'view' ): float {
	return (float) ( $this->has_cogs() && $this->cogs_is_enabled( __METHOD__ ) ? $this->get_prop( 'cogs_value', $context ) : 0 );
}