WC_Abstract_Order::add_order_item_totals_fee_rows( array $total_rows, string $tax_display )

Add total row for fees.


Description Description


Parameters Parameters

$total_rows

(Required) Reference to total rows array.

$tax_display

(Required) Excl or incl tax display mode.


Top ↑

Source Source

File: includes/abstracts/abstract-wc-order.php

2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
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(
                'label' => $fee->get_name() . ':',
                'value' => wc_price( 'excl' === $tax_display ? $fee->get_total() : $fee->get_total() + $fee->get_total_tax(), array( 'currency' => $this->get_currency() ) ),
            );
        }
    }
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.