• 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

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

Yii Ajax Submit button

How to get total pages of PDF with FPDF?

How to create a cookie to store the timestamp of when a page is first loaded with php

json_encode turns array into an object

I want a way to give path to my files which are outside of public folder in laravel

How to auto populate preferredCountries from intl-tel-input with db output

Parameter is not sent to Laravel route in Ajax

Composer Script echo

Wordpress add responsive srcset header image to theme

Insert And Retrieve Data in MySQL with $.post Noob Question

How to redirect to another page and call a Function there on Angular ng-click

Can't find vendor/autoload.php for Ratchet

Insert a DIV after the 6th product only once in WooCommerce category archives

Spam Filter in Contact Form

About Contact Privacy policy Terms and conditions