Print Templates - Conditional Printing

  • Updated

This is one article in a series of articles about Print Templates.

Conditional Printing

When you write HTML print templates, there will be scenarios where you only want to include text under certain conditions. 

One example could be customer notes, you may only want to include the customer notes if there actually is notes from the customer.

This can be solved using the if condition.

An if block is started with the #if() keyword and must be terminated with the #end keyword. The HTML between the #if() and the #end.

The example below will include customer notes only if customer notes were entered on the order.

#if(${order.customernotes})

<div>

Customer Notes: ${order.customernotes}

<div>

#end

Links to related articles on Print Templates:

Print Templates Overview

Print template keywords

How to add styles to a print template

How to create a table in a print template

 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request