• 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 change product Image when variables are selected in Shop and Archive Pages?

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

PHP web3 ERC20 token function call

Unable to uninstall brew php from homebrew

How can I get a div content in php

WordPress + Nginx on non-standard port behind AWS ELB results in broken links

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

I want to store data in new index as per my key in php [duplicate]

php mysql + create a friend request system

Yii2 redirecting to previous page after login

Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path: ) in Unknown on line 0

Get WooCommerce product variation attribute terms in admin products general box

Must be of the type array, null given,

Edit product hook WooCommerce

About Contact Privacy policy Terms and conditions