WooCommerce automatically assigns to a new registered user the “Customer” role. What to do if you wish assign another role instead of Customer used by WooCommerce?
Thanks to WooCommerce developer for the intensive use of WordPress filters. There is a special filter ‘woocommerce_new_customer_data’ which allows to change such new registered user attributes as: user_login, user_pass, user_email, role.
This code example replaces ‘customer’ role, which WooCommerce uses by default with a ‘subscriber’ role.
Replace ‘subscriber’ with role ID of your choice and place this code into the active theme functions.php file or setup is a separate .php file into ‘wp-content/mu-plugins’ folder as a “Must Use” plugin.
You did it!