Created
June 23, 2015 10:20
-
-
Save woogist/fc8782c506c5fe5a5c7f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
add_action( 'subscription_expired', 'wc_custom_remove_subscription', 5, 2 ); | |
function wc_custom_remove_subscription( $user_id, $subscription_key ) { | |
$subscription = WC_Subscriptions_Manager::get_subscription( $subscription_key ); | |
$valid_ids = array( 100, 101, 102 ); | |
if ( isset( $subscription['product_id'] ) && isset( $subscription['order_id'] ) ) { | |
$product_id = $subscription['product_id']; | |
if ( in_array( $product_id, $valid_ids ) ) { | |
remove_action( 'subscription_expired', array( 'Groups_WS_Handler', 'subscription_expired' ), 10, 2 ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment