- Filter : wp_travel_booking_show_end_date
- Filter: wp_travel_booking_post_id_to_update
- Filter: wp_travel_booking_form_fields
- Filter: wptravel_booking_offset
- Filter: wp_travel_booking_section_main_title
- Filter: wp_travel_select_date_label
- Filter: wp_travel_select_date_notice_label
- Filter: wp_travel_same_day_booking
- Filter: wp_travel_enable_canceled_booking_for_customer
- Filter: wptravel_email_content_for_booking_cancelation
- Custom Booking Cancellation
- Filter: wp_travel_cancel_booking_days_limit
Filter : wp_travel_booking_show_end_date #
This filter helps to remove the end date.
function wp_travel_remove_dates (){
return false;
}
add_filter('wp_travel_booking_show_end_date','wp_travel_remove_dates');
Filter: wp_travel_booking_post_id_to_update #
Booking ID to update data.
function prefix_wp_travel_booking_post_id_to_update( $booking_id, $key, $field_name ) {
$booking_id = โBOOKING IDโ;
return $booking_id;
}
add_filter( 'wp_travel_booking_post_id_to_update', 'prefix_wp_travel_booking_post_id_to_update', 12, 3 );
Filter: wp_travel_booking_form_fields #
WP Travel booking form fields.
function prefix_wp_travel_booking_form_fields( $booking_fields ) {
$booking_fields[ โcustom fieldโ ] = โvalueโ;
return $booking_fields;
}
add_filter( 'wp_travel_booking_form_fields', 'prefix_wp_travel_booking_form_fields' );
Filter: wptravel_booking_offset #
Since WP Travel v8.3.0
This filter allows you to specify how many days before the trip departure date bookings should be blocked.
add_filter( 'wptravel_booking_offset', function() {
return 2; // Change the value '2' to the desired offset in days.
} );
Learn More: How to Set an Offset while Booking with WP Travel?
Filter: wp_travel_booking_section_main_title #
Since WP Travel v9.4.0
Using this code you can change the text โSelect Date and Pricing Options for this trip in the Trip Options setting,โ.
add_filter( 'wp_travel_booking_section_main_title', function(){
return 'Select your date';
});
Filter: wp_travel_select_date_label #
Since WP Travel v9.4.0
add_filter( 'wp_travel_select_date_label', function(){
return 'Select calendar';}
);
Using this code you can change the text โSelect a Dateโ.
Filter: wp_travel_select_date_notice_label #
Since WP Travel v9.4.0
Using this code you can change the text โSelect a Date to view available pricing and other optionsโ.
add_filter( 'wp_travel_select_date_notice_label', function(){
return 'Select the date you are willing to travel';
} );
Learn More: How to Customize Date Selection Labels?
Filter: wp_travel_same_day_booking #
Since WP Travel Pro v9.5.0
A new hook enables same-day trip bookings for applicable itineraries, which works for trips with a duration only.
add_filter( 'wp_travel_same_day_booking', function(){
return true;
} );
Filter: wp_travel_enable_canceled_booking_for_customer #
WP Travel Pro v10.2.0
By default, booking cancellation is disabled for customers. You can enable it using a simple filter hook.
add_filter( 'wp_travel_enable_canceled_booking_for_customer', function () {
return true;
});
Filter: wptravel_email_content_for_booking_cancelation #
Use the following code to modify the cancellation email message:
add_filter('wptravel_email_content_for_booking_cancelation',
function ( $message, $traveler_name, $traveler_lname, $booking_id ) {
$message = "
<h2>Custom Booking Cancellation</h2>
<p>Dear Admin,</p>
<p>The following booking has been <strong>successfully canceled</strong>:</p>
<ul>
<li><strong>Customer Name:</strong> {$traveler_name} {$traveler_lname}</li>
<li><strong>Booking ID:</strong> {$booking_id}</li>
</ul>
<p>Please take the necessary action.</p>
";
return $message;
},
10,
4
);
Filter: wp_travel_cancel_booking_days_limit #
You can restrict how many days before the travel date a customer is allowed to cancel a booking.
add_filter( 'wp_travel_cancel_booking_days_limit', function( $days, $booking_id, $travel_date ) {
return 15; // Set the cancellation limit to 15 days before the travel date
}, 10, 3 );
Learn More: How to Enable the Booking Cancellation Feature?



