15

How to Set Default User Registration Role in WooCommerce

Powered by WPCodeBox

Learn how to set the default user registration role in WooCommerce by adjusting line 5 of the provided code snippet, replacing ‘subscriber’ with your desired role.


// Set Woocommerce Default User Registration Role
add_filter('woocommerce_new_customer_data', 'wc_assign_custom_role', 10, 1);
 
function wc_assign_custom_role($args) {
  $args['role'] = 'subscriber';
  
  return $args;
}

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.