Displaying order notes

There are several ways to display order notes in your documents:

Using a custom block (Premium Templates) #

With the Premium Templates extension, you can add order notes to the document using one (or more) of the following placeholders in a custom block (Type: Text):

  • {{order_notes}} – The “public” order notes that are also emailed to your customer (colored blue in the order backend)
  • {{private_order_notes}} – The “private” order notes only visible to store admins (colored pink and grey in the backend)

In a custom template #

First, you need to create a custom template by following instructions here: Creating a custom PDF template.

Then place the following snippet where you would like the order notes to appear:

<?php $this->order_notes(); ?>

to display only private notes:

<?php $this->order_notes('private'); ?>

if you want to display all order notes, including the (private) admin notes, use:

<?php $this->order_notes('all'); ?>

With a template action hook #

It is also possible to display order notes without creating a custom template, by using one of the template action hooks and adding it to your themes functions.php:

add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_order_notes', 10, 2 );
function wpo_wcpdf_order_notes ($template_type, $order) {
    $document = wcpdf_get_document( $template_type, $order );
    $document->order_notes();
}

or limited to the packing slip:

add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_order_notes', 10, 2 );
function wpo_wcpdf_order_notes ($template_type, $order) {
    if ($template_type == 'packing-slip') {
        $document = wcpdf_get_document( $template_type, $order );
        $document->order_notes();
    }
}