WC_Order::add_order_item_totals_refund_rows()
Add total row for refunds.
Method of the class: WC_Order{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->add_order_item_totals_refund_rows( $total_rows, $tax_display );
- $total_rows(array) (required) (passed by reference — &)
- Total rows.
- $tax_display(string) (required)
- Tax to display.
WC_Order::add_order_item_totals_refund_rows() WC Order::add order item totals refund rows code WC 9.6.1
protected function add_order_item_totals_refund_rows( &$total_rows, $tax_display ) { $refunds = $this->get_refunds(); if ( $refunds ) { foreach ( $refunds as $id => $refund ) { $reason = trim( $refund->get_reason() ); if ( strlen( $reason ) > 0 ) { $reason = "<br><small>$reason</small>"; } $total_rows[ 'refund_' . $id ] = array( 'label' => __( 'Refund', 'woocommerce' ) . ':', 'value' => wc_price( '-' . $refund->get_amount(), array( 'currency' => $this->get_currency() ) ) . $reason, ); } } }