A client of mine asked me to add some additional text to the thank you page and the customer order email. In both cases, my client wanted to show an immediate upsell to get buyers to go back to the website and buy again with a coupon code.

PHP snippet: Add Content to the Customer Processing Order Email – WooCommerce
/** * @snippet Add Content to the Customer Processing Order Email - WooCommerce * @how-to Get CustomizeWoo.com FREE * @author Rodolfo Melogli * @testedwith Woo 3.8 * @donate $9 https://businessbloomer.com/bloomer-armada/ */ add_action( 'woocommerce_email_before_order_table', 'bbloomer_add_content_specific_email', 20, 4 ); function bbloomer_add_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) { if ( $email->id == 'customer_processing_order' ) { echo '<h2 class="email-upsell-title">Get 20% off</h2><p class="email-upsell-p">Thank you for making this purchase! Come back and use the code "<strong>Back4More</strong>" to receive a 20% discount on your next purchase! Click here to continue shopping.</p>'; } }
How to target other WooCommerce Order Emails
Using the same snippet above, you can target different emails by changing the email ID
if ( $email->id == 'cancelled_order' ) {} if ( $email->id == 'customer_completed_order' ) {} if ( $email->id == 'customer_invoice' ) {} if ( $email->id == 'customer_new_account' ) {} if ( $email->id == 'customer_note' ) {} if ( $email->id == 'customer_on_hold_order' ) {} if ( $email->id == 'customer_refunded_order' ) {} if ( $email->id == 'customer_reset_password' ) {} if ( $email->id == 'failed_order' ) {} if ( $email->id == 'new_order' ) {}