Add Order Notes To WooCommerce Completed Order Email

Each you perform an action regarding a WooCommerce order, a note is created. This is the best way to track every single action made on an order, and of course that’s very useful when your team needs to get the full order history. That can be also useful to share this order notes history to your customer. The best way to do it is to add the notes in the completed order email. What you need to know is that these notes are WordPress comments, so any WordPress comments related function can be used, and you can retrieve any data using the comment object.

Here what you can see in the administration, on the order edit page:

admin-order-notes

To display all these notes in the order completed email, simply add the following code to the customer-completed-order.php file. Please note that this file is a template; basically a custom template allows you to override WooCommerce default files and use your own custom files instead. Here is a quick tutorial that will explain you how to create your custom templates: http://docs.woothemes.com/document/template-structure/

So, create a folder called woocommerce in your theme folder. In this folder, create a new folder called emails, and in this folder duplicate the customer-completed-order.php from wp-content/plugins/woocommerce/templates/emails. And add this snippet at line 51:

Here is the result in the email:

email-order-notes

Liked it? Keep me awake with a coffee!

17 thoughts on “Add Order Notes To WooCommerce Completed Order Email

  1. Hiya Remi, what are your thoughts on the following?

    In woocommerce you can add purchase notes – which is displayed on both checkout + in confirmation email.

    If the “groups plugin” is installed and activated, the purchase notes are no longer sent in the confirmation email.

    Do you have any thoughts on what code could be entered into the email template to ensure purchase notes continue to be sent in the confirmation email?

  2. When I plug this into the code of my template, I only get the h2 header (Order Notes) but the rest of the info isn’t there. I’m using WP 3.6.1 any thoughts? HELP! :(

      1. ‘approve’,
        ‘post_id’ => $order->id
        );
        $comments = get_comments($args);
        foreach($comments as $comment) :
        echo $comment->comment_content . ”;
        endforeach;
        ?>

        1. ‘approve’,
          ‘post_id’ => $order->id
          );
          $comments = get_comments($args);
          foreach($comments as $comment) :
          echo $comment->comment_content . ”;
          endforeach;
          ?>

  3. Remy, I have a question regarding one of the images you used here. In your email to the customer, in the table, there is NO tax behind your listed product. Why is that? Any idea where to option to fin to set it to be shown? I ask, becaue I have two shops. One is showing taxes behind the productname in this email-table, the other won’t. And all settings seems to be the same in both shops. Maybe you can help me where to find the option to show taxes behind products in the table in the customer email they get when they ordered. Here is a screenshot showing what information I mean.http://imgur.com/ABwTAok

  4. How about a snippet for adding the products original price into the mail next to the total price of the product(s).

    So it would go:
    Product | Quantity | Unit Price | Total Price ??

    Is it possible to do something like that in the new order email?

    Man Thanks

  5. Hi

    Is it possible to send just the last note? I don’t want my customers know how much stock do I have after they bougth and just want to add a custom note “tracking number” in order to let them know their tracking number order.

    Thanks!

    1. Were you ever able to figure this out Anfeloga? We are running into the same issue. Don’t want the customer to see all notes. Our shipment processor adds a note with tracking information, but we only want to send the last note, not all of them with payment notes, stock, etc.

      Any ideas? Thanks!

  6. Hi Remi,

    The code works as expected for me when I am completing the order or re-sending the completed e-mail via the woocommerce admin.

    However, I am finding that it does not work when I call via the API and set the order status to completed. Basically no comments are making its way down to the e-mail view. Have any thoughts on why they might not be accessible and how to work around?

    Thanks – Ryan

  7. woocommerce-shipstation/includes/api-requests/class-wc-shipstation-api-shipnotify.php

    Starting at Line 142:

    $order->add_order_note( $order_note, $is_customer_note = 1 );

    // Update order status
    if ( $order_shipped ) {
    $order->update_status( WC_ShipStation_Integration::$shipped_status );
    $this->log( sprintf( __( “Updated order %s to status %s”, ‘woocommerce-shipstation’ ), $order->id, WC_ShipStation_Integration::$shipped_status ) );
    }

    The order completed email is sent out when the order status has been set to completed, great. However, it seems that none of the order notes are available.

    Added the order notes to email template per Remi’s post: http://www.remicorson.com/add-order-notes-to-woocommerce-completed-order-email/

    Not sure why this is happening. Maybe because the woocommerce-shipstation plug-in doesn’t load the WordPress comments when the email is being sent. If I manually set the order status to Completed, the order notes are included in the email.

    [ MY FIX ]
    The only way for me to be able to get the order note added at Line 142 was to store it in $GLOBALS:

    $order->add_order_note( $order_note, $is_customer_note = 1 );

    // Update order status
    if ( $order_shipped ) {
    $GLOBALS[‘SS_order_note_on_shipped’] = $order_note;

    }

    Now in /wp-content/themes/mytheme/woocommerce/emails/customer-completed-order.php I can access $GLOBALS[‘SS_order_note_on_shipped’] to get the value of the note when the order completed email is sent out.

    Hoping to find a solution that doesn’t require that I modify the plug-in code though.

    Thanks for everything!

Leave a Reply