WC_Email_Customer_POS_Completed_Order::order_item_totalspublicWC 1.0

Add additional details to the order item totals table.

Method of the class: WC_Email_Customer_POS_Completed_Order{}

No Hooks.

Returns

Array. Modified array of total rows.

Usage

$WC_Email_Customer_POS_Completed_Order = new WC_Email_Customer_POS_Completed_Order();
$WC_Email_Customer_POS_Completed_Order->order_item_totals( $total_rows, $order, $tax_display );
$total_rows(array) (required)
Array of total rows.
$order(WC_Order) (required)
Order object.
$tax_display(string) (required)
Tax display.

WC_Email_Customer_POS_Completed_Order::order_item_totals() code WC 10.8.1

public function order_item_totals( $total_rows, $order, $tax_display ) {
	$cash_payment_change_due_amount = $order->get_meta( '_cash_change_amount', true );
	if ( '' !== $cash_payment_change_due_amount ) {
		$formatted_cash_payment_change_due_amount     = wc_price( $cash_payment_change_due_amount, array( 'currency' => $order->get_currency() ) );
		$total_rows['cash_payment_change_due_amount'] = array(
			'type'  => 'cash_payment_change_due_amount',
			'label' => __( 'Change due:', 'woocommerce' ),
			'value' => $formatted_cash_payment_change_due_amount,
		);
	}

	$auth_code = $order->get_meta( '_charge_id', true );
	if ( ! empty( $auth_code ) ) {
		$total_rows['payment_auth_code'] = array(
			'type'  => 'payment_auth_code',
			'label' => __( 'Auth code:', 'woocommerce' ),
			'value' => $auth_code,
		);
	}

	if ( $order->get_date_paid() !== null ) {
		$total_rows['date_paid'] = array(
			'type'  => 'date_paid',
			'label' => __( 'Time of payment:', 'woocommerce' ),
			'value' => wc_format_datetime( $order->get_date_paid(), get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ),
		);
	}

	return $total_rows;
}