WC_Order::add_order_item_totals_payment_method_row
Add total row for the payment method.
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_payment_method_row( $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_payment_method_row() WC Order::add order item totals payment method row code WC 10.5.0
protected function add_order_item_totals_payment_method_row( &$total_rows, $tax_display ) {
if ( $this->get_total() > 0 && $this->get_payment_method_title() && 'other' !== $this->get_payment_method() ) {
$value = $this->get_payment_method_title();
$card_info = $this->get_payment_card_info();
if ( isset( $card_info['last4'] ) && $card_info['last4'] ) {
$value .= ' - ' . $card_info['last4'];
}
$total_rows['payment_method'] = array(
'type' => 'payment_method',
'label' => __( 'Payment method:', 'woocommerce' ),
'value' => $value,
);
}
}