Automattic\WooCommerce\Blocks\Domain\Services\CheckoutFieldsSchema
DocumentObject::get_customer_data
Get the customer data.
Метод класса: DocumentObject{}
Хуков нет.
Возвращает
Массив. The customer data.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_customer_data();
Код DocumentObject::get_customer_data() DocumentObject::get customer data WC 10.5.2
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'] ?? (object) [],
$this->schema_controller->get( ShippingAddressSchema::IDENTIFIER )->get_item_response( $this->customer )
),
'billing_address' => wp_parse_args(
$this->request_data['customer']['billing_address'] ?? (object) [],
$this->schema_controller->get( BillingAddressSchema::IDENTIFIER )->get_item_response( $this->customer )
),
'additional_fields' => $this->request_data['customer']['additional_fields'] ?? (object) [],
];
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;
}