Automattic\WooCommerce\Internal\Admin

WCAdminUser::update_user_data_values()publicWC 1.0

For all the registered user data fields ( Loader::get_user_data_fields ), update the data for the REST API.

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

No Hooks.

Return

null. Nothing.

Usage

$WCAdminUser = new WCAdminUser();
$WCAdminUser->update_user_data_values( $values, $user, $field_id );
$values(array) (required)
The new values for the meta.
$user(WP_User) (required)
The current user.
$field_id(string) (required)
The field id for the user meta.

Code of WCAdminUser::update_user_data_values() WC 7.1.0

public function update_user_data_values( $values, $user, $field_id ) {
	if ( empty( $values ) || ! is_array( $values ) || 'woocommerce_meta' !== $field_id ) {
		return;
	}
	$fields  = $this->get_user_data_fields();
	$updates = array();
	foreach ( $values as $field => $value ) {
		if ( in_array( $field, $fields, true ) ) {
			$updates[ $field ] = $value;
			self::update_user_data_field( $user->ID, $field, $value );
		}
	}
	return $updates;
}