Automattic\WooCommerce\StoreApi\Routes\V1

CartUpdateCustomer::get_customer_shipping_address()protectedWC 1.0

Get full customer shipping address.

Method of the class: CartUpdateCustomer{}

No Hooks.

Return

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() code WC 9.3.3

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(
		[
			'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
	);
}