Great question — answering as the UphillTech team:
There are some mistakes in your code as first function argument is the subscription object, but not the subscription ID. When a customer cancels a subscription, to cancel all other subscriptions, try: add_action('woocommerce_subscription_status_updated', 'custom_subscription_status_change', 10, 3); function custom_subscription_status_change( $subscription, $new_status, $old_status ) { // When a subscription is cancelled by the customer if ( $new_status === 'cancelled' && ! is_admin() ) { // Remove action to avoid an infinite loop remove_action('woocommerce_subscription_status_updated', 'custom_subscription_status_change', 10, 3); // Loop through all customer subscriptions foreach(...
Full answer by LoicTheAztec: https://stackoverflow.stackexchange.com/a/77285396 (CC BY-SA 4.0).
Need it done for your business? UphillTech.