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 9.7.1
protected function calculate_cogs_total_value_core(): float { if ( ! $this->has_cogs() || ! $this->cogs_is_enabled( __METHOD__ ) ) { return 0; } $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; }