• 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

Symfony/Form add attribute based on the data

How to install php yaml on CentOs?

How to create a video stream from a single dynamic image in PHP

How to show a popup modal in codeIgniter?

How can I access an array/object?

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

How to check user Permissions using Custom Middleware in Laravel

Display Brand Name Above Product Title in Woocommerce Cart, Checkout Page, Orders and Email Notification

backup files to google drive using PHP

User pool client {id}does not exist

Utf8 encoding issue with Laravel

PHP: Insert marker every 3 iterations

advanced custom fields wordpress custom class

About Contact Privacy policy Terms and conditions