Skip to content

Instantly share code, notes, and snippets.

@woogist
Created June 23, 2015 07:35
Show Gist options
  • Save woogist/edcfd945bf858222bf08 to your computer and use it in GitHub Desktop.
Save woogist/edcfd945bf858222bf08 to your computer and use it in GitHub Desktop.
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 );
if ( isset( $subscription['product_id'] ) && isset( $subscription['order_id'] ) ) {
$product_id = $subscription['product_id'];
if ( $product_id == 100 ) {
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