How to add custom message to the order processing email

Follow these steps to add a custom message before the order table in the processing order email:

1. Open your theme’s functions.php file

Navigate to your child theme’s directory and locate the functions.php file. If it doesn’t exist, create one.

2. Insert the following code snippet

Copy and paste the code snippet below into your functions.php file:

/*
* add custom message in before order table in the processing order emails
*/
add_action( 'woocommerce_email_before_order_table', 'add_custom_message_before_order_table', 10, 4 );

function add_custom_message_before_order_table( $order, $sent_to_admin, $plain_text, $email ) {		

	// Iterating through order shipping items
	foreach ( $order->get_items( 'shipping' ) as $item_id => $shipping_item_obj ) {			
		$shipping_method = $shipping_item_obj->get_method_id();						
	}
	
	//IF  dshipping method is not local pickup then @return;
	if ( !isset($shipping_method ) ) {
		return;
	}
	if ( isset($shipping_method ) && 'local_pickup' != $shipping_method ) {
		return;		
	}
	
	if ( 'customer_processing_order' != $email->id ) {
		return;
	}
	
	// add additional content in email
	echo '<p>' . wp_kses_post("You will receive an email when your order is ready for pickup. This will also include the pickup address. Please do not arrive to pick up your order until you have been notified it's ready.") . '</p>';
	
}

3. Save the file

Save the changes to your functions.php file.

By following these steps, you’ve successfully added a custom message to the order processing email. Customize the added message as needed for your specific requirements.

$129.00

Billed annually

Buy Now