• 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

woocommerce get_order_report_data to show order_item_id

How to create a individual template for page or post in custom plugin?

Problems getting instance of UploadedFile in Yii2

Don't show recurring price for WooCommerce subscriptions worth 0$

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

Laravel You requested 1 items, but there are only 0 items available

CodeIgniter 4: Like and Dislike Functionality

how to youtube api data to print in toolset metabox using a button click before save-post

Class AppHttpControllersUserController Does Not Exist

javascript html popup window

Elastic Beanstalk with Laravel Envoy

google content api for shopping

Must be of the type array, null given,

Laravel Carbon throws error The format separator does not match

Laravel Sanctum CSRF not authenticating

About Contact Privacy policy Terms and conditions