Forked from jrick1229/Skip 'Pending Cancellation' when a customer cancels their subscripton
Last active
June 28, 2018 15:32
-
-
Save JPry/91bae3b7629e8f8ac841d9e640f1e3d6 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