• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

WooCommerce Subscriptions: Remove role on cancelled subscription

phpwordpresswoocommercehook-woocommercewoocommerce-subscriptions


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');
}

Related Snippets

Is it possible to change the table name in the migration file-laravel

Show only featured products in Woocommerce shop page

Doctrine 2 mapping referencing unique key

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

Show only featured products in Woocommerce shop page

I want to display a sweetalert after the inserting of data in my database

How to display table header in every page using FPDF library?

laravel controller function parameters

Add bold text and line break into Laravel Notification Email

How to Create WooCommerce Subscription Product via. REST API?

woocommerce change position of price

Load a .env file with PHP

zsh: command not found: php

WordPress Security Standards want me to escape my html, but how to do it correctly?

how to hide previous markers when new markers added in google map javascript api

About Contact Privacy policy Terms and conditions