WC_Abstract_Order::add_order_item_totals_fee_rows
Add total row for fees.
Метод класса: WC_Abstract_Order{}
Хуки из метода
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->add_order_item_totals_fee_rows( $total_rows, $tax_display );
- $total_rows(массив) (обязательный) (передается по ссылке — &)
- Reference to total rows array.
- $tax_display(строка) (обязательный)
- Excl or incl tax display mode.
Код WC_Abstract_Order::add_order_item_totals_fee_rows() WC Abstract Order::add order item totals fee rows WC 10.5.2
protected function add_order_item_totals_fee_rows( &$total_rows, $tax_display ) {
$fees = $this->get_fees();
if ( $fees ) {
foreach ( $fees as $id => $fee ) {
if ( apply_filters( 'woocommerce_get_order_item_totals_excl_free_fees', empty( $fee['line_total'] ) && empty( $fee['line_tax'] ), $id ) ) {
continue;
}
$total_rows[ 'fee_' . $fee->get_id() ] = array(
'type' => 'fee',
'label' => $fee->get_name() . ':',
'value' => wc_price( 'excl' === $tax_display ? (float) $fee->get_total() : (float) $fee->get_total() + (float) $fee->get_total_tax(), array( 'currency' => $this->get_currency() ) ),
);
}
}
}