WC_Order_Item_Product::calculate_cogs_value_core
Calculate the Cost of Goods Sold value for this line item.
Метод класса: WC_Order_Item_Product{}
Хуков нет.
Возвращает
float|null. The calculated value, null if the product associated to the line item no longer exists.
Использование
$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 WC 10.8.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();
}