QUANTM7 Docs
PlatformDocuments

Document Templates

Customise document layouts with Quill templates using the built-in code editor.

Every document type has two editing modes: Editor and Code. Editor mode uses visual toggles to control what appears on the document. Code mode gives you full control over the layout using Quill templates.

Editor vs Code mode

FeatureEditor modeCode mode
How it worksToggle switches control each sectionYou edit the template directly
Skill neededNoneBasic HTML and Quill syntax
CustomisationSection-level (show/hide, colours, font)Pixel-level (any layout you want)
Best forMost storesStores with specific layout requirements

Both modes produce the same PDF format. Switching between them does not lose your work. Your code template is preserved when you switch to editor, and your editor settings remain when you switch to code.

Switching modes

At the top of the document builder, click Editor or Code to switch. The first time you switch to code mode, the system generates a default template based on your current editor settings. You can edit this template or start fresh.

The code editor

Code mode shows a split view:

  • Left panel: A code editor with syntax highlighting and autocomplete
  • Right panel: A live PDF preview that updates as you type

The editor supports Quill template syntax inside HTML. As you type {{ or {%, autocomplete suggests available variables, tags, and filters.

Saving

Click the Save button or press Ctrl+S to save your template. The save only affects code mode. Your editor mode settings are separate.

Resetting

Click Reset to replace your template with the default. This regenerates the template from the current default for that document type. A confirmation dialog appears before the reset happens.

Validation

If your template has syntax errors, a warning appears below the editor with the error details. Fix the error before saving to ensure the PDF generates correctly.

Template syntax

Document templates use Quill, the platform's template language. Quill syntax works inside standard HTML. The template is rendered to HTML, then converted to PDF.

Output a variable

Use double curly braces to output a value:

<p>Order #{{ order.order_number }}</p>
<p>Total: {{ order.total_price | money }}</p>

Conditionals

Use if, elsif, and else to show content based on conditions:

{% if config.showLogo %}
  <img src="{{ store.logo_url }}" />
{% endif %}

{% if order.financial_status == 'paid' %}
  <p>PAID</p>
{% elsif order.financial_status == 'pending' %}
  <p>PENDING</p>
{% endif %}

Loops

Use for to iterate over arrays:

{% for item in order.line_items %}
  <tr>
    <td>{{ item.title }}</td>
    <td>{{ item.quantity }}</td>
    <td>{{ item.price | money }}</td>
  </tr>
{% endfor %}

Filters

Filters transform output. Apply them with a pipe |:

FilterWhat it doesExample
moneyFormat as currency{{ order.total_price | money }}
dateFormat a date{{ order.invoice_date | date }}
upcaseConvert to uppercase{{ labels.invoice | upcase }}
downcaseConvert to lowercase{{ store.name | downcase }}
defaultFallback if empty{{ order.note | default: "None" }}

Available variables

The data reference panel in the code editor lists every variable. Here is a summary by group.

Order

VariableTypeDescription
order.order_numbernumberOrder number
order.invoice_numberstringInvoice reference number
order.invoice_datestringInvoice date
order.emailstringCustomer email
order.currencystringCurrency code (GBP, EUR, USD)
order.financial_statusstringPayment status
order.subtotal_pricenumberSubtotal before tax and shipping
order.total_pricenumberTotal amount
order.total_taxnumberTax amount
order.total_discountsnumberDiscount amount
order.total_shippingnumberShipping cost
order.amount_paidnumberAmount already paid
order.amount_duenumberOutstanding balance
order.po_numberstringPurchase order number
order.notestringOrder notes
order.tax_inclusivebooleanWhether prices include tax

Customer and addresses

VariableTypeDescription
order.customer.namestringCustomer full name
order.customer.emailstringCustomer email
order.billing_address.namestringBilling contact name
order.billing_address.linesarrayBilling address lines
order.shipping_address.namestringShipping contact name
order.shipping_address.linesarrayShipping address lines
order.shipping_method.namestringShipping method

Line items

Use {% for item in order.line_items %} to loop through items:

VariableTypeDescription
item.titlestringProduct title
item.variant_titlestringVariant name
item.skustringProduct SKU
item.quantitynumberQuantity ordered
item.pricenumberUnit price
item.line_pricenumberLine total
item.total_discountnumberDiscount on this line
item.original_pricenumberPrice before discount
item.discount_descriptionstringDiscount code or reason

Transactions

Use {% for tx in order.transactions %} to loop through payments:

VariableTypeDescription
tx.datestringTransaction date
tx.methodstringPayment method
tx.amountnumberAmount
tx.statusstringStatus

Fulfillments

Use {% for f in order.fulfillments %} to loop through shipments:

VariableTypeDescription
f.datestringFulfillment date
f.carrierstringCarrier name
f.tracking_numberstringTracking number
f.tracking_urlstringTracking URL
f.service_namestringService name

Store

VariableTypeDescription
store.namestringStore display name
store.company_namestringCompany name
store.addressarrayCompany address lines
store.vat_numberstringVAT registration number
store.logo_urlstringLogo URL
store.contact_emailstringContact email
store.payment_termsstringPayment terms text
store.footer_textstringFooter text

Bank details

VariableTypeDescription
bank.namestringBank name
bank.account_namestringAccount holder name
bank.sort_codestringSort code
bank.account_numberstringAccount number
bank.ibanstringIBAN
bank.swiftstringSWIFT/BIC code

Labels

Labels are translated strings that change based on your document language setting. Examples: labels.invoice, labels.billTo, labels.shipTo, labels.total, labels.subtotal.

Config toggles

Config toggles reflect your editor mode settings. Use them to conditionally show sections: config.showLogo, config.showSku, config.showTracking, config.showBankDetails, and others.

Theme

VariableTypeDescription
theme.primary_colorstringPrimary colour hex
theme.accent_colorstringAccent colour hex
theme.font_familystringFont family name

Example: simple invoice header

<div style="display: flex; justify-content: space-between; margin-bottom: 20px;">
  <div>
    {% if config.showLogo %}
      <img src="{{ store.logo_url }}" style="max-height: 60px;" />
    {% endif %}
    <p style="font-size: 10px; color: #666;">{{ store.company_name }}</p>
  </div>
  <div style="text-align: right;">
    <h1 style="font-size: 24px; color: {{ theme.primary_color }};">
      {{ labels.invoice | upcase }}
    </h1>
    <p>{{ order.invoice_number }}</p>
    <p>{{ order.invoice_date }}</p>
  </div>
</div>

Supported HTML elements

The PDF renderer supports a subset of HTML:

ElementWhat it becomes
divBlock container
p, h1-h6Text with sizing
span, strong, em, b, i, uInline text with style
table, tr, td, thTable layout
imgImage
aHyperlink
hrHorizontal rule
brLine break

Supported CSS properties

The renderer supports common layout and text properties: color, background-color, font-size, font-weight, font-style, text-align, text-decoration, padding, margin, border, width, max-width, display (block/flex), flex-direction, flex, gap, justify-content, align-items, and opacity.

Use inline styles or a <style> block at the top of your template. Class selectors, ID selectors, and element selectors are supported.

Tips

  • Start with the default template and modify it, rather than writing from scratch
  • Use the data reference panel to find the exact variable name you need
  • Test with a real order (not just the preview) to confirm all sections render correctly
  • The money filter formats numbers with the order's currency symbol
  • Use config.* toggles in your template to respect the editor mode settings, so merchants can still toggle sections even in code mode

On this page