WC_Abstract_Order::calculate_cogs_total_value_core
Core method to calculate the Cost of Goods Sold value for this order: 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 order.
Метод класса: WC_Abstract_Order{}
Хуков нет.
Возвращает
float. The calculated value.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->calculate_cogs_total_value_core(): float;
Код WC_Abstract_Order::calculate_cogs_total_value_core() WC Abstract Order::calculate cogs total value core WC 10.5.2
protected function calculate_cogs_total_value_core(): float {
$value = 0;
foreach ( array_keys( $this->item_types_to_group ) as $item_type ) {
$order_items = $this->get_items( $item_type );
foreach ( $order_items as $item ) {
if ( $item->has_cogs() ) {
$item->calculate_cogs_value();
$value += $item->get_cogs_value();
}
}
}
return $value;
}