Automattic\WooCommerce\StoreApi\Routes\V1

Checkout::update_customer_address_field │ private │ WC 1.0

Updates a customer address field.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->update_customer_address_field( $customer, $key, $value, $address_type );
$customer(WC_Customer) (обязательный)
The customer to update.
$key(строка) (обязательный)
The key of the field to update.
$value(разное) (обязательный)
The value to update the field to.
$address_type(строка) (обязательный)
The type of address to update (billing|shipping).

Код Checkout::update_customer_address_field() WC 11.3.0

private function update_customer_address_field( $customer, $key, $value, $address_type ) {
	$callback = "set_{$address_type}_{$key}";

	if ( is_callable( [ $customer, $callback ] ) ) {
		$customer->$callback( $value );
		return;
	}

	if ( $this->additional_fields_controller->is_field( $key ) ) {
		$this->additional_fields_controller->persist_field_for_customer( $key, $value, $customer, $address_type );
	}
}