After successful payment through Razorpay payment gateway, I need to redirect to my custom created Thankyou page, instead of Razorpay payment gateway plugin default redirect URL. My problem illustrated: screen recorded video Here is what I tried in functions.php file: /* Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 're_redirect_woo_checkout'); function re_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'custom thankyou page url here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } } It work which have zero payment product that doesn't need razorpay gateway to popup to pay, it auto redirect instant when clicking proceed to checkout. But when clicking proceed to checkout for payment above zero cost then razorpay gateway popup required to pay through different paying facility, after successfull payment through razorpay payment gateway it's not redirecting to my specific choice of page (custom thank you page).