• 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 can I convert from a{a{} b{}} to a[a[],b[]] using php preg_match?

Change the alert text on add to cart action without selected variation in Woocommerce

Laravel Nova Dependency Container what are the allowed resource properties other than id in dependsOn

Make Calculator - When Button clicked the No shows in Textbox.

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

Filter WooCommerce related products by Polylang language

Laravel 5 issue with wherePivot

Make survey at laravel 5.4 and MySQL

phpseclib 2.0 can not use Composer to create autoload

Two buttons one form

Coinpayments create_transaction "ERROR: Invalid command!"

How to convert a carbon into string, to take the date only?

PHP's array_map including keys

Refresh specific HTML content that retrieves data from MySQL

Cant seem to get the Pagination to work on my WooCommerce REST API application?

About Contact Privacy policy Terms and conditions