WC_Order::add_order_item_totals_refund_rows
Add total row for refunds.
Method of the class: WC_Order{}
No Hooks.
Returns
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 10.5.0
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(
'type' => 'refund',
'label' => __( 'Refund', 'woocommerce' ) . ':',
'value' => wc_price( '-' . $refund->get_amount(), array( 'currency' => $this->get_currency() ) ) . $reason,
);
}
}
}