Automattic\WooCommerce\StoreApi\Routes\V1
CartUpdateCustomer::get_customer_shipping_address
Get full customer shipping address.
Method of the class: CartUpdateCustomer{}
No Hooks.
Returns
Array.
Usage
// protected - for code of main (parent) or child class $result = $this->get_customer_shipping_address( $customer );
- $customer(WC_Customer) (required)
- Customer object.
CartUpdateCustomer::get_customer_shipping_address() CartUpdateCustomer::get customer shipping address code WC 10.7.0
protected function get_customer_shipping_address( \WC_Customer $customer ) {
$additional_fields = $this->additional_fields_controller->get_all_fields_from_object( $customer, 'shipping' );
return array_merge(
array(
'first_name' => $customer->get_shipping_first_name(),
'last_name' => $customer->get_shipping_last_name(),
'company' => $customer->get_shipping_company(),
'address_1' => $customer->get_shipping_address_1(),
'address_2' => $customer->get_shipping_address_2(),
'city' => $customer->get_shipping_city(),
'state' => $customer->get_shipping_state(),
'postcode' => $customer->get_shipping_postcode(),
'country' => $customer->get_shipping_country(),
'phone' => $customer->get_shipping_phone(),
),
$additional_fields
);
}