• 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

dompdf and img tag, image wont show

how to search for a file with php

how to loop through json response data using ajax jquery?

Add rows to Single product Additional information table in WooCommerce 3.6

Issue saving card for customer

Laravel implode array items to new lines

Get lat/lon from google maps url ftid (hex)

woocommerce change position of price

PHP Find Array Index value in multi-line array

How should I get started using PHPUnit as a testing framework for a bunch of functions and classes I have already made?

Unable to create lockable file - Laravel 8 & PHP 8

Get WooCommerce products from specific category

woocommerce get_order_report_data to show order_item_id

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

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

About Contact Privacy policy Terms and conditions