Line Item Comments in Emails and PDFs

Show each line item's comment (the Comment added to a quote or order line) in your own email and PDF templates.

The built-in item tables in quote and order emails already show line comments under each item. Use the variables below when you build your own item rows with {{foreach}}.

Quote emails and PDFs

Inside a loop over the quote's items:

{{foreach quote.getAllVisibleItems() as item}}
    <tr>
        <td>
            {{var item.getName()}}
            {{depend item.getItemComment()}}
                <div>Comment: {{var item.getItemComment()}}</div>
                <div>{{var item.getItemCommentAuthor()}} - {{date item.getItemCommentDate()}}</div>
            {{/depend}}
        </td>
        <td>{{number item.qty}}</td>
        <td>{{price item.price}}</td>
        <td>{{price item.row_total}}</td>
    </tr>
{{/foreach}}
VariableShows
{{var item.getItemComment()}}The comment text
{{var item.getItemCommentAuthor()}}Who wrote it: name and email of the admin or customer ("Admin" for older comments)
{{date item.getItemCommentDate()}}When the comment was last changed. Use {{datetime item.getItemCommentDate()}} to include the time

This works in the New Quote, Quote Update, Quote Reminder and Quote Expiration emails.

Order emails and PDFs

{{foreach order.getAllVisibleItems() as item}}
    {{var item.getName()}}
    {{depend item.getItemComment()}}<div>Comment: {{var item.getItemComment()}}</div>{{/depend}}
{{/foreach}}

{{var item.getItemComment()}} shows the line's comment, including comments set with the item_comment column of the order edit import. Order line comments don't record an author or date.

In invoice, shipment and credit memo emails, the items belong to that document. Use {{var item.getOrderItem().getItemComment()}}.

Good to know

  • A line without a comment shows nothing, so wrap labels in {{depend item.getItemComment()}} ... {{/depend}}.
  • The text is already safe to display (HTML is escaped). Don't add |escape.
  • A custom item loop doesn't follow Hide Price From Customer on a quote: {{price item.price}} always shows the price. The built-in item table hides it. If you use that option, keep the built-in table or use a separate template for those quotes.

Comments in the standard PDFs

  • Quote PDF: line comments always print under the item.
  • Order, Invoice, Shipment and Credit Memo PDFs: line comments print when Enable Item Info Column is on and Only Show Product Name is off for that document in Orders > PDF Settings. Both are the defaults.

See Editing Email Templates for how to edit a template's HTML.


Did this page help you?