WooCommerce

Reducing Password Strength Requirements In WooCommerce

If you have used WooCommerce, then you may be aware of the password strength requirements when a user is attempting to register on your site. This requirement may be a little too strong for your liking but can be reduced with a simple filter.

While I 100% agree a strong password should be used, I have had multiple clients complain the requirement are just too strong. After doing some “search foo” within the WooCommerce plugin directory, I discovered the woocommerce_min_password_strength filter. Simply return an integer between 0 and 3 to adjust as needed.

add_filter( 'woocommerce_min_password_strength', 'example_woocommerce_min_password_strength' );
/**
 * Callback for WooCommerce 'woocommerce_min_password_strength' filter.
 *
 * Reduce the strength requirement on the woocommerce password.
 *
 * 0 = Anything (not a good idea)
 * 1 = Weak
 * 2 = Medium
 * 3 = Strong (default)
 *
 * @param integer $strength
 *
 * @return integer
 */
function example_woocommerce_min_password_strength( $strength ) {

    return 2;

}

I recommend keeping at a strength of 2 or 3. Any lower seems just too weak to me and you want to avoid having security issues on a site due to a lazy password.

Published by

rfmeier

Product developer at WPEngine and runner from Hampshire, Illinois. I work with php a lot; Spending most of my time digging into source code to see how it all works. You can find me on Twitter @rfmeier.

Leave a Reply

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