{{ order_name }} prints the order’s name, {% for line_item in line_items %} repeats for every item. Foliant’s order variables follow Shopify Order Printer’s, so templates written for it mostly work as they are. The code editor is on every plan.
Open the code editor
Open the template in the editor and click the Code tab. Code templates open there directly. For a visual template, you first see the compiled code; click Edit code to change it. See Switch between Visual and Code. Above a code template, Not into code? We can help offers help from our team: select Contact support and tell us what the document should show, and we’ll help you set it up. Close the banner to hide it for good. The left pane has three tabs:
The right pane is the live preview. It updates shortly after you stop typing.
Insert a field
- Put the cursor where the field should go.
- Click Insert field.
- Search for the field (for example “tracking” or “SKU”) under Search fields, and click it.
{{ shipping_address.city }}. Line item fields, such as {{ line_item.sku }}, only work inside the line items loop: insert Line items for the loop itself.
Search the code
Click the search button next to Insert field (or press ⌘F / Ctrl+F in the code) to find text in the template.Code errors
The editor checks your code as you type and marks problems in the margin:- Errors stop you saving and pause the preview. An unclosed
{{or{%is an error. They’re listed in a Code errors banner above the editor, each with Go to line. - Warnings point out things that may be wrong but don’t stop you saving, for example an unknown Liquid filter, tag or object, an unknown HTML tag or CSS property, or an unclosed HTML tag.
Write good templates
- Money values are in cents: always print them with a money filter, such as
{{ total_price | money }}. See Money and currency in templates. - Use
| escapeon text that customers typed, such as notes and addresses:{{ note | escape }}. - Use
{{ 'subtotal' | t }}for wording that follows the document’s language. See Dates, languages and translations. - Use Foliant’s built-in snippets for VAT:
{% include 'vat_breakdown' %}prints the VAT breakdown table, and{% include 'legal_notes' %}the legal notes (reverse charge, export, IOSS…).
Good to know
- If a numbered template (invoice, credit note or quote) doesn’t print
document_numberanywhere, Foliant adds a small line with the number at the end of the document. See Document numbers in templates. - Page numbers and repeated table headers for code templates are on the template’s settings page, under Page layout.
- To bring a template over from Shopify Order Printer or Order Printer Pro, use Import a template on the Templates page. See Import a template from Order Printer.