Send a different “thank you” email based on payment method

Well, I answered my own question. It is somewhat idiosyncratic, but will help those who also want to add a shipping quote manually on their woocommerce site, or otherwise add conditional code to woocommerce emails.

We do this because many of our orders cannot be shipped by a simple carrier, but must be prepared for truck shipments either loose or on pallets. These often require us to send quotes to several truck companies before we find the best deal.

In any case, I was able to edit the customer-processing-order.php email template (in my child theme, of course) and add a conditional test to see the payment method used. When it is “cod” (which looks to the customer as “Submit order for shipping quote” on the front end) they get an appropriate message. Otherwise they see that their order has been released to manufacturing.

The conditional portion (With a couple of lines of the standard woocommerce template for context) is:

    do_action( 'woocommerce_email_header', $email_heading, $email ); ?>

    <?php /* translators: %s: Customer first name */ ?>
    <p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>

    <p><?php 
    if ($order->get_payment_method() == cod)
      {
      printf( esc_html__( 'Order #%s', 'woocommerce' ), esc_html( $order->get_order_number() ) );
      printf('
    Thank you for your order, which has now been sent to our office staff to find the best method to ship this order to you. <strong>Within 1 business day we will send you an updated invoice including a shipping quote and link</strong> which will take you to our credit card payment page. If you have any questions, special requests, or need to have this order expedited, please call our office during business hours at xxx-xxx-xxxx (or 1-800-xxxxxxx)');  
      }
    else
      {
      printf( esc_html__( 'Order #%s is now released to manufacturing', 'woocommerce' ), esc_html( $order->get_order_number() ) );
      printf('
    <strong>Thank you for your payment</strong>, which has been received successfully. Below is the complete order. Please review it for errors or omissions. If you have any further questions call our office during business hours at xxx-xxx-xxxx (or 1-800-xxxxxxx)'); 
      }
    ?></p>