Maybe you didn’t know, but WooCommerce has a tool that forces users to use strong passwords.
It’s not a perfect security system but it works for most users.
Table of Contents
Why would you want to disable the password strength meter?
Well, I can think of several reasons….
One of them is performance. The JavaScript required for the WooCommerce password strength meter to work weighs no less than 400 Kb, and that takes away from the load of all your pages.
On the other hand, who decides how strong your online store passwords should be, WordPress or you?
That’s right.
Ok, I want to disable the password strength meter or change the password strength level.
We will show you how to do both.
Here are some nice codes, which are almost self-explanatory…
How to disable WooCommerce password strength meter.
/* Disable password strength check WC */
function wphelp_remove_password_strength_checker() {
if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
wp_dequeue_script( 'wc-password-strength-meter' );
}
}
add_action( 'wp_print_scripts', 'wphelp_remove_password_strength_checker', 100 );
Code language: JavaScript (javascript)
Adding this code to the end of the active theme’s functions.php file or to your customizations plugin completely disables the password strength meter, altogether.
How to customize the level of stringency in WooCommerce strength meter passwords.
/* Change the level of password strength in WooCommerce */
/* Strenght settings
* 4 = Strong
* 3 = Medium (default)
* 2 = A bit weak
* 1 = Weak
* 0 = Very weak
*/
add_filter( 'woocommerce_min_password_strength', 'wphelp_change_strength_level_wc' );
function wphelp_change_strength_level_wc( $strength ) {
return 4;
}
Code language: PHP (php)
This other code will allow you to change the level of password strength requirement and, as I indicate in the comments of the code, you can change it from 0 to 4, by levels of strength.
Contrary to what you may believe, it does not only serve to lower the strength requirement, because the default WooCommerce level is 3, and you can require even stronger passwords by changing to level 4, as in the example code.
And… nothing more. I hope these tricks will be useful to you sometime.