WC_Order_Item_Product::calculate_cogs_value_core()
Calculate the Cost of Goods Sold value for this line item.
Method of the class: WC_Order_Item_Product{}
No Hooks.
Return
float|null
. The calculated value, null if the product associated to the line item no longer exists.
Usage
$WC_Order_Item_Product = new WC_Order_Item_Product(); $WC_Order_Item_Product->calculate_cogs_value_core(): ?float;
WC_Order_Item_Product::calculate_cogs_value_core() WC Order Item Product::calculate cogs value core code WC 9.5.1
public function calculate_cogs_value_core(): ?float { $product = $this->get_product(); if ( ! $product ) { return null; } $cogs_per_unit = $product->get_cogs_total_value(); return $cogs_per_unit * $this->get_quantity(); }