Created
June 24, 2017 02:55
-
-
Save bryceadams/8ca7ad7936d215ba0d92b66ac3301d50 to your computer and use it in GitHub Desktop.
Automatically change 'pending cancel' subscriptions to 'cancelled'
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 | |
/** | |
* Move pending cancellation to cancelled automatically. | |
*/ | |
function metorik_custom_cancel_function( $subscription, $new_status, $old_status ) { | |
if ( 'pending-cancel' === $new_status ) { | |
$subscription->update_status( 'cancelled' ); | |
} | |
} | |
add_action( 'woocommerce_subscription_status_updated', 'metorik_custom_cancel_function', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment