0

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?

  • If you are using custom registration form then you can pass static password field in user_pass $userdata = array( 'user_login' => XXX, 'user_url' => XXX, 'user_pass' => STATIC_PWD ); $user_id = wp_insert_user( $userdata ) ; – Parth Shah Jul 8 '19 at 10:30
0

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 );
| improve this answer | |
  • Hello, thank you for your answer. I was about to do this, but I found it easier to use the auto generate password option from woocommerce settings and modify the email that the customer got automatically by removing the option to send their password. Again, thank you. – kitmin Jul 10 '19 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.