WC_Email_Customer_POS_Completed_Order::order_item_totalspublicWC 1.0

Add additional details to the order item totals table.

Метод класса: WC_Email_Customer_POS_Completed_Order{}

Хуков нет.

Возвращает

Массив. Modified array of total rows.

Использование

$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 of total rows.
$order(WC_Order) (обязательный)
Order object.
$tax_display(строка) (обязательный)
Tax display.

Код WC_Email_Customer_POS_Completed_Order::order_item_totals() WC 9.9.5

public function order_item_totals( $total_rows, $order, $tax_display ) {
	$cash_payment_change_due_amount           = $order->get_meta( '_cash_change_amount', true );
	$formatted_cash_payment_change_due_amount = wc_price( $cash_payment_change_due_amount, array( 'currency' => $order->get_currency() ) );
	if ( ! empty( $cash_payment_change_due_amount ) ) {
		$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;
}