Reduce or Increase Password Strength WooCommerce

This makes shopping easier for a customer as no credentials are required to purchase every time. While creating an account user needs to enter the password. Though if he or she enters a weak password account is not created. In this article we will show you how you can set the minimum password requirement for WooCommerce. So, you can set minimum password strength required for your store to any level you want.

Before Starting, Please take a backup of your functions.php file.

  • Go to Dashboard-> Appearance-> Editor
  • On the right side, Go to functions file (functions.php)
  • Enter the below code at the bottom of functions file

[codesyntax lang=”php”]

/** 
	 *Reduce the strength requirement on the woocommerce password.
	 * 
	 * Strength Settings
	 * 3 = Strong (default)
	 * 2 = Medium
	 * 1 = Weak
	 * 0 = Very Weak / Anything
	 */
	function reduce_woocommerce_min_strength_requirement( $strength ) {
	    return 1;
	}
	add_filter( 'woocommerce_min_password_strength', 'reduce_woocommerce_min_strength_requirement' );

[/codesyntax]

As you can see that on the 10th line of above code returns 1, means minimum password strength required is Weak, you can change it for your desired level numbers for all levels are written in comments of code above.

Go to your store and add a product to cart.

Move on to checkout page where you will get an option to create account now as you can see below even if I enter a weak password it accepts.

Thats All.

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

Your email address will not be published. Required fields are marked *