I’m using the snippet below to redirect users to a specific page on subscription cancellation. The ‘exit’ though, blocks all subsequent actions associated with the hook (woocommerce email notifications, for example) from firing.

Is there any way to ensure no other actions get blocked? I thought assigning a low priority to this action would do it, but it doesn’t help.

add_action( 'woocommerce_subscription_status_updated', 'redirect',99,3 );

function redirect( $subscription, $new_status, $old_status)
{  
     If( $new_status != "active" )
     {  
        wp_redirect( "https://dummyexample.com/" );
       exit;
     };
}

Read more here: Use wp_redirect without blocking other actions


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: