Woocommerce : Add name filed of checkout page to buyers wordpress display name

The second part of the problem is solved by putting this code into theme’s functions.php file :

// First name as default display name

add_action( 'profile_update', 'set_display_name', 10 );

function set_display_name( $user_id ) {

    $data = get_userdata( $user_id );

    if($data->first_name) {

        remove_action( 'profile_update', 'set_display_name', 10 ); // profile_update is called by wp_update_user, so we need to remove it before call, to avoid infinite recursion
        wp_update_user( 
            array (
                'ID' => $user_id, 
                'display_name' => "$data->first_name"
            ) 
        );
        add_action( 'profile_update', 'set_display_name', 10 );
    }
}

Only the first problem remains to be solved that is to add “Digits” phone number field to billing_phone field in woocommerce orders.

tech