WP Travel / WP Travel Pro plugin provides various email templates that will be received during booking only and booking with payments. In this guide, you’ll learn how you can change email content when booking status is changed.

In the earlier update, a function was added, so that when the admin changes the booking status email will be sent to the customer.

You can simply change the booking status.

Now, with the release of WP Travel v8.2.0, the function has been added, so the admin can customize the booking status email as per the requirements using the filter code.

Default booking status changed mail received by the customer

Default booking status changed mail received by the customer

So, to change the email content, please add the following code to the functions.php file of your child theme.

Steps to Change Email Content when Booking Status is Changed

1. Add code to functions.php

function wptravel_change_booking_status_email_content( $message, $traveller_name, $old_status, $new_status ) {
    return "<h2>Dear {$traveller_name},</h2>
	    <p>This email is the customized email. Your booking status has been updated from <b>" . $old_status . "</b> to <b>" . $new_status ."</b>.</p><br>
	<h3>Thank you.</h3>";}
add_filter( 'wptravel_email_content_for_booking_status', 'wptravel_change_booking_status_email_content', 10, 4 );

For detailed information on creating a child theme, please refer to our KnowledgeBase.

2. Mail received by the customer after adding customized content

Mail received by the customer after adding customized content

Additionally, you can change the subject of the email template using a hook.

Hook to change the Subject of booking status Email

add_filter( 'wptravel_email_subject_for_booking_status', function(){
	return __( 'Customized Subject for Booking status', 'wp-travel' );
} );

Hook to disable email when booking status is changed

If you want to disable email when booking status is changed, add this code to your functions.php:

add_filter( 'wp_travel_change_booking_status_mail_sending', function(){
    return false;
} );

Also, if you want to learn more about the filter hook that is used to rename fields on the checkout page, please refer to the specific hook page.

Conclusion

By following the easy steps above you can change email content when booking status is changed.

Check the WP Travel documentation to learn more about configurations, modules, payments, and shortcodes.

Your feedback helps us improve. Feel free to share your thoughts!

Need assistance? Contact our support team, join our Facebook community, and subscribe to our YouTube Channel for video tutorials.

You can also find us on Facebook, Instagram, LinkedIn, TikTok, and X. Thank you for choosing WP Travel.

If you are a WP Travel Free user thinking about upgrading to Pro, simply click on the banner below.

Get WP Travel Pro