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 | |
// Make sure WooCommerce Subscriptions is active | |
if ( class_exists( 'WC_Subscriptions_Switcher' ) ) { | |
// Get the key for the customer's current subscription | |
$subscription_key = WC_Subscriptions_Manager::get_subscription_key( $order_id, $product_id ); | |
// Check if the current subscription can be switched by the customer | |
if ( WC_Subscriptions_Manager::can_subscription_be_changed_to( 'new-subscription', $subscription_key, get_current_user_id() ) ) { |