WC_API_Customers::add_customer_data( $order_data, $order )
Add customer data to orders
Description Description
Parameters Parameters
- $order_data
-
(Required)
- $order
-
(Required)
Return Return
(array)
Source Source
File: includes/legacy/api/v2/class-wc-api-customers.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; }
Changelog Changelog
Version | Description |
---|---|
2.1 | Introduced. |