WC_Order_Item::calculate_cogs_value_coreprotectedWC 1.0

Core method to calculate the Cost of Goods Sold value for this line item: it doesn't check if COGS is enabled at class or system level, doesn't fire hooks, and doesn't set the value as the current one for the line item.

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

Хуков нет.

Возвращает

float|null. The calculated value, or null if the value can't be calculated for some reason.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->calculate_cogs_value_core(): ?float;

Код WC_Order_Item::calculate_cogs_value_core() WC 10.7.0

protected function calculate_cogs_value_core(): ?float {
	// phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
	throw new Exception(
		sprintf(
			// translators: %1$s = class and method name.
			__( 'Method %1$s is not implemented. Classes overriding has_cogs must override this method too.', 'woocommerce' ),
			__METHOD__
		)
	);
	// phpcs:enable WordPress.Security.EscapeOutput.ExceptionNotEscaped
}