Skip to content

Instantly share code, notes, and snippets.

@vanbo
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanbo/b5b6653d59fd73c31885 to your computer and use it in GitHub Desktop.
Save vanbo/b5b6653d59fd73c31885 to your computer and use it in GitHub Desktop.
Add own HTML for Customer order note
/**
* Add the code to your theme functions.php file
*/
// Remove the order meta function from the email
remove_action( 'woocommerce_email_order_meta', array( WC()->mailer(), 'order_meta' ), 10, 3 );
// Add your own order meta function
add_action( 'woocommerce_email_order_meta', 'woo_add_order_notes_to_email', 10, 3 );
function woo_add_order_notes_to_email( $order, $sent_to_admin = true, $plain_text = false ) {
// If you want to send those only to the Admin
if ( ! $sent_to_admin ) {
return;
}
// Get the order note
$customer_note = $order->customer_message;
echo '<h4 style="font-family:Arial,sans-serif;font-size:120%;line-height:110%;color:red;">Order Notes</h4>';
echo '<ul class="order_notes">';
if ( $customer_note ) {
echo '<li class="customer-note note">'. $customer_note .'</li>';
} else {
echo '<li class="no-order-comment">There are no order notes</li>';
}
echo '</ul>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment