So, are you looking forward to changing email content when payment status is changed?

Well, WP Travel / WP Travel Pro plugin provides various email templates that will be received during booking only and booking with payments.

Previously, when the admin changed the payment status through the dashboard, mail used to be sent to the customer.

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

Default 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 Payment Status is Changed

1. Add code to functions.php

function wptravel_change_payment_status_email_content( $message, $traveller_name, $old_status, $new_status ) {
    return "<h2>Dear {$traveller_name},</h2>
        <p>This email is the customized email. Your payment status has now been updated from {$old_status} to {$new_status}.</p><br>
    <h3>Thank you.</h3>";}
add_filter( 'wptravel_email_content_for_payment_status', 'wptravel_change_payment_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

Additionally, if you want to change the subject of the email template, you can do so using a hook.

Hook to change the Subject of payment status Email

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

Hook to disable email when Payment status is changed

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

add_filter( 'wp_travel_change_payment_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 specific hook page.

Conclusion

By following the easy steps above you can change email content when payment 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