WC_Order_Item::calculate_cogs_value_core
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.
Method of the class: WC_Order_Item{}
No Hooks.
Returns
float|null. The calculated value, or null if the value can't be calculated for some reason.
Usage
// protected - for code of main (parent) or child class $result = $this->calculate_cogs_value_core(): ?float;
WC_Order_Item::calculate_cogs_value_core() WC Order Item::calculate cogs value core code 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
}