Automattic\WooCommerce\Blocks\Domain\Services\CheckoutFieldsSchema

DocumentObject::get_customer_data()protectedWC 1.0

Get the customer data.

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

Хуков нет.

Возвращает

Массив. The customer data.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_customer_data();

Код DocumentObject::get_customer_data() WC 9.8.5

protected function get_customer_data() {
	$customer_data = [
		'id'                => $this->request_data['customer']['id'] ?? $this->customer->get_id(),
		'shipping_address'  => wp_parse_args(
			$this->request_data['customer']['shipping_address'] ?? [],
			$this->schema_controller->get( ShippingAddressSchema::IDENTIFIER )->get_item_response( $this->customer )
		),
		'billing_address'   => wp_parse_args(
			$this->request_data['customer']['billing_address'] ?? [],
			$this->schema_controller->get( BillingAddressSchema::IDENTIFIER )->get_item_response( $this->customer )
		),
		'additional_fields' => $this->request_data['customer']['additional_fields'] ?? [],
	];

	if ( 'shipping_address' === $this->context ) {
		$customer_data['address'] = $customer_data['shipping_address'];
	}

	if ( 'billing_address' === $this->context ) {
		$customer_data['address'] = $customer_data['billing_address'];
	}

	return $customer_data;
}