Adding custom text in any WooCommerce email using woocommerce_email_before_order_table & woocommerce_pretty_before_template hooks

Here's a few snippet that gives you the logic to combine core WooCommerce hooks and WooCommerce pretty email hooks. In this example we are adding a text to the customer invoice email (including the order date) just before the order table :


function maybe_add_some_text_to_invoice($template){

	if( strrpos($template, 'customer-invoice') !== false )
	add_action('woocommerce_email_before_order_table', 'add_text_to_invoice' );


function add_text_to_invoice($template){
	echo '<p>My text in invoice email. Date : {order_date}</p>';