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_booking_status', function(){
	return __( 'Customized Subject for Booking status', 'wp-travel' );
} );

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

So, in this way, you can change email content when payment status is changed precisely.

If you liked this article, then subscribing to our YouTube Channel for WordPress video tutorials would be the cherry on top.

You can also find us on FacebookInstagram, Twitter,LinkedinTikTokPinterest and our dedicated engaging Facebook user community,

Further, if you have any queries, please submit them to our contact page.

Get WP Travel Pro and start creating your travel and tour booking website within minutes without any hassle of coding.

create your travel site within minutes by wptravel.io ,buy wptravel pro