Did you whitelist your new URL in the allowed redirect URLs?
Filter allowed_redirect_hosts here:
https://docs.wphotelier.com/article/59-redirect-to-external-website
It is redirecting to Paypal
function hotelier_custom_add_to_cart_from_room_list_redirect( $url ) {
$custom_url = ‘ https://secure1.sandbox.directpay.online/payv2.php?ID=XXXX’;
return $custom_url;
}
add_filter( ‘hotelier_add_to_cart_from_room_list_redirect’, ‘hotelier_custom_add_to_cart_from_room_list_redirect’ );
function hotelier_custom_allowed_redirect_hosts( $content ) {
$content[] = ‘secure1.sandbox.directpay.online/payv2.php?ID=XXXX’; // without http(s)://
return $content;
}
add_filter( ‘allowed_redirect_hosts’, ‘hotelier_custom_allowed_redirect_hosts’ , 10 );
This is the correct code. Tested and it works:
https://pastebin.com/raw/QjPPKPA6
Best Regards,
Benito
Thank you for your prompt response Benitolopez,
But it is redirecting to https://www.paypal.com/webapps/shoppingcart/error?flowlogging_id=45e802033e909&code=NO_BUSINESS
please kindly assist
regards
The code above is to redirect the user to an external website when they click on the “Reserve” button in the listing page. This is the listing page:
http://manila.wphotelier.com/available-rooms/
I see that you’re using a custom theme so probably your theme is customizing WP Hotelier.
Hello Benitolopez,
Thank you once again
I think the problem might be coming from the Theme (Hotello)
For me to redirect to external website, do i need to enable Paypal in the Hotelier-> Setting-> Payment Gateway.
regards
Well… no. I think you should avoid going to the booking form and redirect first. Maybe changing the URL of the “Check availability” button in the single room page. Here for example:
https://www.hotels.khalees.com/rooms/deluxe-room-crystal-house-hotels/
To change the URL you need to contact the author of your theme, because that button is not part of WP Hotelier.
As I said, the code above it’s for the listing page only. This:
http://manila.wphotelier.com/available-rooms/
You shouldn’t change the URL on the booking page (the page where you see the final form). Usually if one is redirecting to another site it means that he is using another system. So he will use another form, not the booking form of WP Hotelier.
Anyway, everything is possible. So if you need to change something in the final form, you can find all the related code in the wp-hotelier/templates/booking/ folder. You can override one or more of those files to adjust your needs. But unfortunately, I can’t help you with that.
To override a template file, check this article:
https://docs.wphotelier.com/article/66-override-template-files
Hope this helps.
Best Regards,
Benito