Add a Message to the Order Completed Email
Inserts your own paragraph, such as care instructions or a review request, above the order details in the WooCommerce "Order completed" email.
Opens WPIDE on
Code
add_action( 'woocommerce_email_before_order_table', function ( $order, $sent_to_admin, $plain_text, $email ) {
$message = 'Thank you for your order! We would love to hear what you think, so keep an eye out for a short review request next week.';
if ( $sent_to_admin || ! $email || 'customer_completed_order' !== $email->id ) {
return;
}
if ( $plain_text ) {
echo esc_html( $message ) . "\n\n";
} else {
echo '<p>' . esc_html( $message ) . '</p>';
}
}, 10, 4 );
Notes
Change $message. Plain-text emails get the message without HTML.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.