1. Home
  2. Knowledge Base
  3. WooCommerce Members Only
  4. Advanced Topics for Members Only
  5. Remove existing user roles when purchasing a membership product

Remove existing user roles when purchasing a membership product

You can use the following filter to remove existing user roles if a user is assigned a new role when purchasing a product:

<?php
/**
* Remove existing user roles if a user is assigned a new role when purchasing a product
*/
add_filter( 'wcmo_remove_existing_roles', '__return_true' );

This is how to add a snippet.

Was this article helpful?

Related Articles