Last active
November 29, 2018 17:21
-
-
Save jrick1229/12ded626944f1f8a8f6bb816efadb671 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_customer_changed_subscription_to_cancelled', 'customer_skip_pending_cancellation' ); | |
/** | |
* Change 'pending-cancel' status directly to 'cancelled'. | |
* | |
* @param WC_Subscription $subscription | |
*/ | |
function customer_skip_pending_cancellation( $subscription ) { | |
if ( 'pending-cancel' === $subscription->get_status() ) { | |
$subscription->update_status( 'cancelled', 'Your subscription has been cancelled.' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment