Redirect user to specific page if Manual/Offline gateway is selected

This will redirect the user to a page with payment information in case he selects the Manual/Offline payment gateway.

1
2
3
4
5
6
7
8
9
10
11
12
add_action('pms_get_redirect_url', 'pmsc_redirect_after_manual_payment', 10, 2);
function pmsc_redirect_after_manual_payment( $url, $location ) {
	if ($_POST['pay_gate'] != 'manual')
		return $url;
 
	$subscription_plan = pms_get_subscription_plan($_POST['subscription_plans']);
 
	if ($subscription_plan->price == 0)
		return $url;
	else
		return home_url('/payment-info');
}

The page slug can be modified on this line: return home_url('/payment-info');