Home / Admin / Force Minimum Password Length at Checkout
Duplicate Snippet

Embed Snippet on Your Site

Force Minimum Password Length at Checkout

Force a minimum password length when a customer creates an account at checkout

Code Preview
php
<?php
function sumobi_edd_set_minimum_password_length( $valid_data, $post_data  ) {
	// how many characters should the password be?
	$length = 8;
	if ( strlen( $post_data['edd_user_pass'] ) < $length ) {
		edd_set_error( 'password_too_short', sprintf( __( 'Please enter a password of %s characters or more.', 'edd' ), $length ) );
	}
	
}
add_action( 'edd_checkout_error_checks', 'sumobi_edd_set_minimum_password_length', 10, 2 );

Comments

Add a Comment