If you don’t want to assign the WooCommerce user role “customer” to new… customers, there is simple PHP that can be added to your functions.php to achieve this. Enjoy!

Change WooCommerce user role upon registration

PHP Snippet: Change User Role for New Customers – WooCommerce

/**
 * @snippet       Change User Role for New Customers - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WC 3.7
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
///////////////////////////////
// 1. ADD NEW ROLE
 
add_role( 'pending', __( 'Pending' ), array(
  'read' => true, 
));
 
///////////////////////////////
// 2. ASSIGN NEW ROLE
 
add_filter( 'woocommerce_new_customer_data', 'bbloomer_assign_custom_role', 10, 1 );
 
function bbloomer_assign_custom_role( $args ) {
  $args['role'] = 'pending';
  return $args;
}
Share:

Leave a Reply