Join

Set WooCommerce Default User Registration Role

Don't want to mess with code snippets? Request for this to be a feature of MyListing Pro.

Instructions

  1. Create a new PHP code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

In the example, we are setting the default role to ‘Subscriber’, but you can set your desired role by editing the ‘$args[‘role’] = ‘subscriber’;’ entry.

add_filter('woocommerce_new_customer_data', 'wc_assign_custom_role', 10, 1);

function wc_assign_custom_role($args) {
  $args['role'] = 'subscriber';

  return $args;
}