WC_Abstract_Order::add_order_item_totals_tax_rows()
Add total row for taxes.
Method of the class: WC_Abstract_Order{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->add_order_item_totals_tax_rows( $total_rows, $tax_display );
- $total_rows(array) (required) (passed by reference — &)
- Reference to total rows array.
- $tax_display(string) (required)
- Excl or incl tax display mode.
WC_Abstract_Order::add_order_item_totals_tax_rows() WC Abstract Order::add order item totals tax rows code WC 9.7.1
protected function add_order_item_totals_tax_rows( &$total_rows, $tax_display ) { // Tax for tax exclusive prices. if ( 'excl' === $tax_display && wc_tax_enabled() ) { if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) { foreach ( $this->get_tax_totals() as $code => $tax ) { $total_rows[ sanitize_title( $code ) ] = array( 'type' => 'tax', 'label' => $tax->label . ':', 'value' => $tax->formatted_amount, ); } } else { $total_rows['tax'] = array( 'type' => 'tax', 'label' => WC()->countries->tax_or_vat() . ':', 'value' => wc_price( $this->get_total_tax(), array( 'currency' => $this->get_currency() ) ), ); } } }