$order = new WC_Order($order_id);
$order_email = $order->billing_email;
$email = email_exists( $order_email );
$user = username_exists( $order_email );
$random_password = wp_generate_password();
$userdata = array(
'user_pass' => $random_password,
'user_login' => $order_email,
'first_name' => $order->billing_first_name,
'user_email' => $order_email,
'role' => 'customer',
);
$userid = wp_insert_user( $userdata );