• 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

Transpose and flatten multiple rows of array data [duplicate]

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

javascript html popup window

stay with the last 15 elements of an array [duplicate]

Adding custom body class to the custom archive pages

PHP contact form configuration [duplicate]

Issue with laravel eloquent model property

Undefined Array Key error when uploading image on php

php echo remove slashes from url [duplicate]

Transfer data between JavaScript and PHP through JSON

Form Validation and Submission to database

HTML + PHP + PHPMAILER

Elastic Beanstalk with Laravel Envoy

How to redirect to another page after n seconds in wordpress without using javascript?

auth pages not getting css in laravel

About Contact Privacy policy Terms and conditions