Better Code For WooCommerce Order Complete Email Notes

I previously wrote a post to help you add code to WooCommerce Order Complete emails that would display the proper order notes(original article: Add Order Notes To WooCommerce Completed Order Email). This is an updated article with newer code that also includes some error checking.

Read that article to get a handle on things. I'll jump straight in here to show you the code here and then give a quick code explanation.

Why Use This Better Code

This code first checks to see if there is anything to actually print first, and only if there are order notes to print will it even display the heading. In the old code, the heading would display whether you had order notes to print or not. I've also cleaned up the code a little bit. Clean code is good code.

Better WooCommerce Order Complete Email Notes Code

Code Explanation

This gets the (proper) order notes and tests to see if there actually are any. IF there are order notes to display, only then do we go into the display code.

Here I've simplified the code and put it on less lines. Other than that, it's the same as before.

  • Hi there…I have spent the better part of an entire day trying to get the “comment_content” from the wp_comments table into the admin-new-order.php.

    I know there is comment content there, but when I use your code this is what I get:

    Order Notes

    There are no notes for this order yet.

    I use a plugin for email transfer that generates a code, I need that code to go to the order admin without them having to log into WP to check each order.

    Please help!!


  • Your code is 3 years old but still quite useful and concise, thank you 🙂 FYI, I found the “_e” function (localization) messed up formatting, and used the double “__” instead. This might be different for each Woo install.

  • I have not been able to get this to work in some time? Here is the code for the file,

    <h2 >get_order_number() ); ?>

    <table cellspacing="0" cellpadding="6" style="border-collapse:collapse; width: 100%; border: 1px solid ;” border=”1″ bordercolor=””>

    <th scope="col" width="50%" style="text-align:center; border: 1px solid ;”>
    <th scope="col" width="25%" style="text-align:center; border: 1px solid ;”>
    <th scope="col" width="25%" style="text-align:center; border: 1px solid ;”>

    echo ” . _e( ‘Track your UPS package here, or FedEx Package here. Simply copy and paste your number into the “Track by Number” box provided.’, ‘Order Notes’, ‘woocommerce’ ) . ”;
    foreach($comments as $comment) {
    echo $comment->comment_content . ”;

    <?php if ( version_compare( WOOCOMMERCE_VERSION, '2.3', '

    billing_email ) : ?>
    billing_email; ?>

    billing_phone ) : ?>
    billing_phone; ?>

    $order ) ); ?>

    • Assuming you pasted in the file you’re using correctly, then there are pieces missing that make the dynamic code part work. Mostly, you’re missing opening/close tags to switching the code from pure html to php code and back.

      Again, assuming what you posted here is the full thing here’s a fixed up version:

    • get_order() ) && $booking->get_status() == ‘pending-confirmation’ ) {
      $opening_paragraph = __( ‘A booking has been made by %s and is awaiting your approval. The details of this booking are as follows:’, ‘woocommerce-bookings’ );
      } else {
      $opening_paragraph = __( ‘A new booking has been made by %s. The details of this booking are as follows:’, ‘woocommerce-bookings’ );


      if ( $order ) {
      if ( version_compare( WC_VERSION, ‘3.0’, ‘billing_first_name;
      $last_name = $order->billing_last_name;
      } else {
      $first_name = $order->get_billing_first_name();
      $last_name = $order->get_billing_last_name();


      get_product()->get_title(); ?>

      get_id(); ?>

      has_resources() && ( $resource = $booking->get_resource() ) ) : ?>

      post_title; ?>

      get_start_date(); ?>

      get_end_date(); ?>

      has_persons() ) : ?>
      get_persons() as $id => $qty ) :
      if ( 0 === $qty ) {

      $person_type = ( 0

      get_order() ) && $booking->get_status() == ‘pending-confirmation’ ) : ?>

      get_id() . ‘&action=edit’ ) ) ); ?>

      how do i get get_customer_order_notes on above code?

    • >