I'm trying to create a custom registration for the customer in the woocommerce registration page. Basically, I want the users to register with their their basic details, without their password. Once they do, I will be the one to generate their password for them in the wordpress dashboard. Is this possible? And how can I do this?
I'm trying to create a custom registration for the customer in the woocommerce registration page. Basically, I want the users to register with their their basic details, without their password. Once they do, I will be the one to generate their password for them in the wordpress dashboard. Is this possible? And how can I do this?
Use this snippet to create user without password
$website = "http://example.com";
$userdata = array(
'user_login' => 'login_name',
'user_url' => $website,
'user_pass' => NULL // When creating an user, password is expected.
);
$user_id = wp_insert_user( $userdata ) ;
//after this you can update user on this way
update_user_meta( $user_id, 'some_meta_key', $meta_value );
or
//create user with random password
$random_password = wp_generate_password( $length=12, $include_standard_special_chars=false );
$user_id = wp_create_user( $user_name, $random_password, $user_email );
//then update/add user information on this way
update_user_meta( $user_id, 'some_meta_key', $meta_value );
user_pass
$userdata = array( 'user_login' => XXX, 'user_url' => XXX, 'user_pass' => STATIC_PWD );
$user_id = wp_insert_user( $userdata ) ;
– Parth Shah Commented Jul 8, 2019 at 10:30