Tour Master – How to add a note in the invoice email

The docs for developer mean you must have knowledge and coding skill. Although, we’re create the docs for developer to help you achieve something not available in original feature, but we don’t provide support for anything not work when you reference with docs for developer. If the example code not work for you, please debug it by your-self or hire a freelancer to debug it for you instead.

All the customize will lose when you update our theme/plugin to new version in future. To avoid it, you must use filter and action: https://developer.wordpress.org/plugins/hooks/.

I will show you how to add a note in the invoice email today.

First, open this file: /wp-content/plugins/tourmaster/include/mail-util.php around the price breakdown section and you will get the default code look like below:

// price breakdown
if( !empty($result->pricing_info) ){
    $pricing_info = json_decode($result->pricing_info, true);
    echo '<div>'; // tourmaster-invoice-price-breakdown
    echo '<div style="padding: 18px 25px; font-size: 14px; font-weight: 700; text-transform: uppercase; color: #454545; background-color: #f3f3f3" >'; // tourmaster-invoice-price-head
    echo '<span style="width: 80%; float: left;" >' . esc_html__('Description', 'tourmaster') . '</span>'; // tourmaster-head
    echo '<span style="overflow: hidden;" >' . esc_html__('Total', 'tourmaster') . '</span>'; // tourmaster-tail
    echo '</div>'; // tourmaster-invoice-price-head

    echo tourmaster_get_tour_invoice_price_email($result->tour_id, $pricing_info['price-breakdown'], $booking_detail);

    echo '<div style="font-weight: bold; padding: 18px 25px; border-width: 1px 0px 2px; border-style: solid; border-color: #e1e1e1;" >'; // tourmaster-invoice-total-price
    echo '<span style="float: left; margin-left: 55%; width: 25%; font-size: 15px;" >' . esc_html__('Total', 'tourmaster') . '</span> '; // tourmaster-head
    echo '<span style="display: block; overflow: hidden; font-size: 16px;" >' . tourmaster_money_format($result->total_price) . '</span>'; // tourmaster-tail
    echo '</div>'; // tourmaster-invoice-total-price

    echo '</div>'; // tourmaster-invoice-price-breakdown
}

Then change it like the code below:

// price breakdown
if( !empty($result->pricing_info) ){
    $pricing_info = json_decode($result->pricing_info, true);
    echo '<div>'; // tourmaster-invoice-price-breakdown
    echo '<div style="padding: 18px 25px; font-size: 14px; font-weight: 700; text-transform: uppercase; color: #454545; background-color: #f3f3f3" >'; // tourmaster-invoice-price-head
    echo '<span style="width: 80%; float: left;" >' . esc_html__('Description', 'tourmaster') . '</span>'; // tourmaster-head
    echo '<span style="overflow: hidden;" >' . esc_html__('Total', 'tourmaster') . '</span>'; // tourmaster-tail
    echo '</div>'; // tourmaster-invoice-price-head

    echo tourmaster_get_tour_invoice_price_email($result->tour_id, $pricing_info['price-breakdown'], $booking_detail);

    echo '<div style="font-weight: bold; padding: 18px 25px; border-width: 1px 0px 2px; border-style: solid; border-color: #e1e1e1;" >'; // tourmaster-invoice-total-price
    echo '<span style="float: left; margin-left: 55%; width: 25%; font-size: 15px;" >' . esc_html__('Total', 'tourmaster') . '</span> '; // tourmaster-head
    echo '<span style="display: block; overflow: hidden; font-size: 16px;" >' . tourmaster_money_format($result->total_price) . '</span>'; // tourmaster-tail
    echo '</div>'; // tourmaster-invoice-total-price

    // THE NOTE IN THE INVOICE EMAIL
    echo '<div style="padding: 18px 25px; font-size: 14px; font-weight: 700; text-transform: uppercase; color: #454545; background-color: #f3f3f3" >'; // tourmaster-invoice-price-note
    echo '<span style="width: 100%;" >' . esc_html__('Note', 'tourmaster') . '</span>'; // tourmaster-head
    echo '</div>'; // tourmaster-invoice-price-head
    echo '<span style="display:block;font-size:13px; padding-top: 20px;">'. esc_html__('My note here','tourmaster') .'</span>';
    // END THE NOTE IN THE INVOICE EMAIL

    echo '</div>'; // tourmaster-invoice-price-breakdown
}

Then you will get the result like my screenshot if everything correct.