WooCommerce Subscriptions: Remove role on cancelled subscription
PHP Snippet 1:
add_action('woocommerce_subscription_status_cancelled', 'wcs_maybe_remove_role', 10, 1);
function wcs_maybe_remove_role($subscription) {
$user_id = $subscription->get_user_id();
$user = new WP_User($user_id);
$user->remove_role('silver');
$user->remove_role('gold');
}