Automattic\WooCommerce\StoreApi\Routes\V1

CartUpdateCustomer::get_customer_billing_address()protectedWC 1.0

Get full customer billing address.

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

Хуков нет.

Возвращает

Массив.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_customer_billing_address( $customer );
$customer(\WC_Customer) (обязательный)
Customer object.

Код CartUpdateCustomer::get_customer_billing_address() WC 9.8.1

protected function get_customer_billing_address( \WC_Customer $customer ) {
	$additional_fields = $this->additional_fields_controller->get_all_fields_from_object( $customer, 'billing' );

	return array_merge(
		[
			'first_name' => $customer->get_billing_first_name(),
			'last_name'  => $customer->get_billing_last_name(),
			'company'    => $customer->get_billing_company(),
			'address_1'  => $customer->get_billing_address_1(),
			'address_2'  => $customer->get_billing_address_2(),
			'city'       => $customer->get_billing_city(),
			'state'      => $customer->get_billing_state(),
			'postcode'   => $customer->get_billing_postcode(),
			'country'    => $customer->get_billing_country(),
			'phone'      => $customer->get_billing_phone(),
			'email'      => $customer->get_billing_email(),
		],
		$additional_fields
	);
}