Is it possible to remove the password field in the registration page in woocommerce?

admin2025-01-08  2

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?

Share Improve this question asked Jul 8, 2019 at 5:23 kitminkitmin 33 bronze badges 1
  • 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 Commented Jul 8, 2019 at 10:30
Add a comment  | 

1 Answer 1

Reset to default 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 );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736268778a1302.html

最新回复(0)