Merge pull request #20233 from rnaby/250518-165054-wc-user-functions-wc_create_new_customer

wc_create_new_customer logic simplified
This commit is contained in:
Mike Jolley 2018-05-25 12:03:22 +01:00 committed by GitHub
commit e239f9101b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -73,13 +73,14 @@ if ( ! function_exists( 'wc_create_new_customer' ) ) {
}
// Handle password creation.
$password_generated = false;
if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && empty( $password ) ) {
$password = wp_generate_password();
$password_generated = true;
} elseif ( empty( $password ) ) {
}
if ( empty( $password ) ) {
return new WP_Error( 'registration-error-missing-password', __( 'Please enter an account password.', 'woocommerce' ) );
} else {
$password_generated = false;
}
// Use WP_Error to handle registration errors.