WordPress at a glance
function is not described

WC_API_Customers::add_customer_data() public WC 2.1

Add customer data to orders

{} It's a method of the class: WC_API_Customers{}

No Hooks.

Return

Array.

Usage

$WC_API_Customers = new WC_API_Customers();
$WC_API_Customers->add_customer_data( $order_data, $order );
$order_data (required)
-
$order (required)
-

Changelog

Since 2.1 Introduced.

Code of WC_API_Customers::add_customer_data() WC 5.0.0

<?php
public function add_customer_data( $order_data, $order ) {

	if ( 0 == $order->get_user_id() ) {

		// add customer data from order
		$order_data['customer'] = array(
			'id'               => 0,
			'email'            => $order->get_billing_email(),
			'first_name'       => $order->get_billing_first_name(),
			'last_name'        => $order->get_billing_last_name(),
			'billing_address'  => array(
				'first_name' => $order->get_billing_first_name(),
				'last_name'  => $order->get_billing_last_name(),
				'company'    => $order->get_billing_company(),
				'address_1'  => $order->get_billing_address_1(),
				'address_2'  => $order->get_billing_address_2(),
				'city'       => $order->get_billing_city(),
				'state'      => $order->get_billing_state(),
				'postcode'   => $order->get_billing_postcode(),
				'country'    => $order->get_billing_country(),
				'email'      => $order->get_billing_email(),
				'phone'      => $order->get_billing_phone(),
			),
			'shipping_address' => array(
				'first_name' => $order->get_shipping_first_name(),
				'last_name'  => $order->get_shipping_last_name(),
				'company'    => $order->get_shipping_company(),
				'address_1'  => $order->get_shipping_address_1(),
				'address_2'  => $order->get_shipping_address_2(),
				'city'       => $order->get_shipping_city(),
				'state'      => $order->get_shipping_state(),
				'postcode'   => $order->get_shipping_postcode(),
				'country'    => $order->get_shipping_country(),
			),
		);

	} else {

		$order_data['customer'] = current( $this->get_customer( $order->get_user_id() ) );
	}

	return $order_data;
}