Redirect To External Website

You can redirect the guest to an external website (like booking.com, airbnb.com, etc) using the hotelier_add_to_cart_from_room_list_redirect filter.

function hotelier_custom_add_to_cart_from_room_list_redirect( $url ) {
    $custom_url = 'http://example.com';

    return $custom_url;
} 
add_filter( 'hotelier_add_to_cart_from_room_list_redirect', 'hotelier_custom_add_to_cart_from_room_list_redirect' );

You can also pass the checkin/checkout dates in this way:

function hotelier_custom_add_to_cart_from_room_list_redirect( $url ) {
    $checkin  = HTL()->session->get( 'checkin' );
    $checkout = HTL()->session->get( 'checkout' );

    $custom_url = add_query_arg( array(
		'checkin'  => sanitize_text_field( $checkin ),
		'checkout' => sanitize_text_field( $checkout ),
	), 'http://example.com' );

    return $custom_url;
} 
add_filter( 'hotelier_add_to_cart_from_room_list_redirect', 'hotelier_custom_add_to_cart_from_room_list_redirect' );

Please note, you need to add that custom external host to the allowed redirect hosts. Otherwise the code above won't work. This is an example:

function hotelier_custom_allowed_redirect_hosts( $content ) {
    $content[] = 'example.com'; // without http(s)://
	
    return $content;
}
add_filter( 'allowed_redirect_hosts', 'hotelier_custom_allowed_redirect_hosts' , 10 );

It's important to understand that the code above must be used to redirect your visitors when they click on the "Reserve" button in the listing page. It doesn't work on the datepickers placed on your pages. To redirect your users when they click on the "Check availability" button use this code instead:

function hotelier_custom_datepicker_redirect( $url ) {
    $custom_url = 'http://example.com';

    return $custom_url;
} 
add_filter( 'hotelier_datepicker_form_url', 'hotelier_custom_datepicker_redirect' );

If you need to pass more info, override the datepicker template: wp-hotelier/templates/global/datepicker.php.