Automattic\WooCommerce\Internal\Orders

OrderAttributionController::set_customer_source_data()privateWC 1.0

Save source data for a Customer object.

Method of the class: OrderAttributionController{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->set_customer_source_data( $customer );
$customer(WC_Customer) (required)
The customer object.

OrderAttributionController::set_customer_source_data() code WC 9.5.1

private function set_customer_source_data( WC_Customer $customer ) {
	// Nonce check is handled before user_register hook.
	// phpcs:ignore WordPress.Security.NonceVerification
	foreach ( $this->get_source_values( $this->get_unprefixed_field_values( $_POST ) ) as $key => $value ) {
		$customer->add_meta_data( $this->get_meta_prefixed_field_name( $key ), $value );
	}

	$customer->save_meta_data();
}