WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Routes

Checkout::update_customer_from_request() private WC 1.0

Updates the current customer session using data from the request (e.g. address data).

Address session data is synced to the order itself later on by OrderController::update_order_from_cart()

{} It's a method of the class: Checkout{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->update_customer_from_request( $request );
$request(WP_REST_Request) (required)
Full details about the request.

Code of Checkout::update_customer_from_request() WC 5.7.0

private function update_customer_from_request( WP_REST_Request $request ) {
	$customer = wc()->customer;

	if ( isset( $request['billing_address'] ) ) {
		foreach ( $request['billing_address'] as $key => $value ) {
			if ( is_callable( [ $customer, "set_billing_$key" ] ) ) {
				$customer->{"set_billing_$key"}( $value );
			}
		}
	}

	if ( isset( $request['shipping_address'] ) ) {
		foreach ( $request['shipping_address'] as $key => $value ) {
			if ( is_callable( [ $customer, "set_shipping_$key" ] ) ) {
				$customer->{"set_shipping_$key"}( $value );
			} elseif ( 'phone' === $key ) {
				$customer->update_meta_data( 'shipping_phone', $value );
			}
		}
	}

	$customer->save();
}