Skip to article
auto·printerHelpSystem status
All help articles

Template variables reference

Updated · 15 min read

On this page

Every variable and helper you can use in a custom template, in one place. Variables pull live order data into your document; helpers format it.

Wrap a variable in double curly braces to print its value: {{order.name}} prints the order number, such as #1042. Inside the editor, Variables jumps to the variable list (click one to copy it), and Help opens a short reference with copy-and-paste examples.

New to custom templates? Start with Custom Templates.

Example interface
Custom template editor · HTML and preview
Edit HTML or CSS, copy data fields from Variables, and switch to Preview to see the current draft. These are sample template variables.Scroll across the illustration to see the full view.

Order#

Variable Shows
{{order.name}} The order number, such as #1042
{{order.created_at}} The order date, in your store's timezone and date format
{{order.phone}} The phone number entered at checkout
{{order.note}} The order note
{{order.tags_string}} The order's tags, comma separated
{{order.po_number}} The purchase order number
{{order.amazon_order_id}} The Amazon order ID, read from the order's tags or its "Source Order Id" detail; empty for other orders
{{order.source_name}}, {{order.channel_name}} Where the order came from
{{order.financial_status}}, {{order.fulfillment_status}} Payment and fulfillment status
{{order.payment_gateway_names_string}} How the customer paid, such as "Vipps"
{{#each order.payment_gateway_names}} Loops over the payment methods one at a time; print each with {{this}}
{{order.payment_terms_due_date}} When a business order with payment terms, such as Net 30, is due, in your store's date format; empty for other orders
{{order.ship_by_date}} The ship-by date, in your store's date format
{{order.priority}} The value of a priority: tag, such as rush from the tag priority:rush; empty when the order has none
{{order.total_weight}} Total weight
{{order.currency}} Currency code

Money#

Variable Shows
{{order.subtotal}} Subtotal: the items after all their discounts, before shipping. Tax is added on top, unless your prices include tax; then the subtotal already includes it
{{order.discount_total}} Discounts on single items only. Discount codes on the whole order are not included; for every discount, use line_items_discount_total
{{order.line_items_original_total}} The items before any discount: the subtotal plus line_items_discount_total. A tip is not included
{{order.line_items_discount_total}} Every discount on the items, both discounts on single items and discount codes on the whole order. line_items_original_total minus this equals the subtotal
{{order.shipping_cost}} Shipping
{{order.tax_total}} Tax
{{order.total_price}} Order total
{{order.amount_paid}}, {{order.balance_due}} Paid, minus refunds, and what is still owed
{{order.total_tip_received}} Tips on the order
{{#if order.taxes_included}} … {{/if}} Shows a block only when your prices include tax. Then the subtotal, item prices and shipping already contain the tax, so print the tax lines as included, not added

Money values come formatted in the order's currency, with its own symbol: a GBP order prints £108.00 and a euro order prints €42.50. Each has a _raw twin, such as {{order.total_price_raw}}, for the plain number.

Once you choose a format under Settings → Language and format, money also follows that region's style, such as 1.234,50 € for Germany. See Print documents in another language.

Taxes and discounts#

Variable Shows
{{#each order.tax_lines}} Loops over the order's taxes
{{this.title}}, {{this.percentage}}, {{this.amount}} Inside that loop: the tax name, its rate such as 8.25%, and the amount
{{#each order.discount_applications}} Loops over the order's discounts
{{this.value}} Inside that loop: the discount, such as 10% or $10.80

Percentages follow your language and format too, so a German format prints 8,25 %.

Addresses#

{{shipping_address.name}}, .company, .phone, .address1, .address2, .city, .province_code, .zip, .country.

{{shipping_address.formatted}} prints the whole address with line breaks. Add white-space: pre-line in your CSS so the breaks show.

Once you choose a format under Settings → Language and format, {{shipping_address.lines}} holds the address lines in the order the destination country expects, such as the postcode before the city for Germany. It leaves out the name and company, so print those first, as in the example below. The country line uses your document language, and .formatted follows the same layout.

<div>{{shipping_address.name}}</div>
{{#ifNotEmpty shipping_address.company}}<div>{{shipping_address.company}}</div>{{/ifNotEmpty}}
{{#if shipping_address.lines}}
  {{#each shipping_address.lines}}<div>{{this}}</div>{{/each}}
{{else}}
  {{#ifNotEmpty shipping_address.address1}}<div>{{shipping_address.address1}}</div>{{/ifNotEmpty}}
  {{#ifNotEmpty shipping_address.address2}}<div>{{shipping_address.address2}}</div>{{/ifNotEmpty}}
  <div>{{shipping_address.city}}, {{shipping_address.province_code}} {{shipping_address.zip}}</div>
  {{#ifNotEmpty shipping_address.country}}<div>{{shipping_address.country}}</div>{{/ifNotEmpty}}
{{/if}}

lines is empty when your store uses the classic format, or when Shopify could not send the formatted address, so keep a fallback like the one above.

The same fields exist under {{billing_address.*}}, including .formatted and .lines.

Line items#

Loop over the items in the order:

{{#each line_items}}
  {{this.quantity}} × {{this.title}}
{{/each}}
Inside the loop Shows
{{this.title}} Product and variant name
{{this.product_title}} Product name without the variant
{{this.variant_title}} Variant name
{{#each this.options_with_values}} The variant's options, each with {{this.name}} and {{this.value}}. See Option names and values
{{this.quantity}} Quantity on the order now (after edits and refunds)
{{this.unfulfilled_quantity}} Units still to ship
{{this.sku}} SKU
{{this.price}}, {{this.unit_price}}, {{this.line_total}} Prices
{{this.discount_amount}} The discount applied to this item
{{this.is_tip}} true when the line is a tip. Shopify lists a tip as a line item, so wrap an item row in {{#unless this.is_tip}} … {{/unless}} and print the tip from {{order.total_tip_received}}
{{this.weight}}, {{this.weight_unit}} Weight of one unit, and its unit, such as GRAMS
{{this.hs_code}}, {{this.country_of_origin}} Customs details: the HS code and the country of origin code (such as US), from the product's inventory settings in Shopify. Empty when not set
{{this.image_url}} Product image
{{this.tags}} Product tags

Item money values have _raw twins too, such as {{this.line_total_raw}}, {{this.unit_price_raw}} and {{this.discount_amount_raw}}.

Outside the loop, {{total_quantity}} is the total number of units and {{line_item_count}} is the number of distinct items. A tip is not an item, so neither counts it. {{line_items.length}} counts every line Shopify lists, a tip line included.

Option names and values#

{{this.variant_title}} shows only the option values, such as "Large / Navy" or just "Yes". To print each option with its name, loop over this.options_with_values inside the line items loop:

{{#each this.options_with_values}}{{this.name}} - {{this.value}}<br>{{/each}}

A product with the option "Add A Wood Pen Refill" prints "Add A Wood Pen Refill - Yes". The options come in the order they are set up on the product. The list is empty for a product without options, and for an item whose product or variant was deleted. If you are moving from Shopify Order Printer, this is the same as its options_with_values.

Line item properties#

Properties are the per-item details a buyer or another app adds at checkout, such as "Gift Wrap: Yes" or an engraving message.

Print them all inside the loop:

{{#each this.custom_attributes}}{{this.key}}: {{this.value}}{{/each}}

Or pull one by name with {{this.custom.<Name>}}. Spaces become underscores, so "Gift Wrap" is {{this.custom.Gift_Wrap}}.

Properties that start with an underscore. Some apps save properties under names that start with an underscore, such as _Fabric or _Text 1. Product options apps often save every customization this way. Shopify hides these from the buyer at checkout, and the variables above skip them, so app data never shows up on your documents unless you ask for it.

To print them, loop over this.all_custom_attributes instead. It lists every property on the item, underscore names included. {{this.name}} gives the name without the underscore, so _Fabric prints as "Fabric":

{{#each this.all_custom_attributes}}{{this.name}}: {{this.value}}<br>{{/each}}

Or pull one by name with {{this.all_custom.<Name>}}, keeping the underscore: {{this.all_custom._Fabric}}.

Other apps can save internal data here too, such as IDs or long codes. Use these variables on your own work sheets, and check a printed preview before you add them to anything your customers see.

Your company and the customer#

Variable Shows
{{company.name}}, .address, .phone, .email, .website Your store details from Settings
{{company.logo_url}} Your default logo
{{company.square_logo_url}} Your square logo
{{company.tax_id}} Your tax ID
{{customer.name}} The customer's full name
{{customer.first_name}}, {{customer.last_name}} The customer's first or last name
{{customer.email}} The customer's email address
{{customer.phone}} The customer's phone number
{{customer.tax_id}} A business buyer's tax ID

The customer's name, email and phone come from their Shopify customer profile, and are empty when the order has no customer.

Logos are set under Settings → Branding; the tax ID under Settings → Store information. See Branding & Tax ID.

Accent color: use var(--brand-accent) in your CSS to pick up the accent color from Branding. Brand intensity applies to built-in templates only.

Shipping#

{{shipping.method}}, {{shipping.tracking_company}} (the carrier, such as USPS), {{shipping.tracking_number}}, {{shipping.tracking_url}}.

Fulfillment location#

For shops that ship from more than one Shopify location:

Variable Shows
{{fulfillment_location.name}} The location's name
{{fulfillment_location.address1}}, {{fulfillment_location.address2}} Street address
{{fulfillment_location.city}}, .province, .zip, .country City, region, postal code, and two-letter country code
{{fulfillment_location.phone}} The location's phone number

These fill in whenever the document belongs to a known location, including orders that ship entirely from one place. They are empty on invoices for split orders, which always cover the whole order, so they are safe to add to any template. See Multi-Location Printing.

Your store's custom fields#

Order attributes, metafields, and line item properties from your own recent orders appear in the editor's Variables list:

  • {{order.custom.<name>}} for order attributes
  • {{order.meta.<namespace>.<key>}} for order metafields
  • {{this.custom.<name>}} for line item properties, inside the line items loop

Field names in any language work, such as {{order.custom.配送日期}}. Spaces become underscores, hyphens and underscores are kept, and other punctuation is dropped.

Product and variant custom fields#

Inside the line items loop, {{lookupBin this "namespace.key"}} prints a product or variant custom field (a metafield), such as a bin location or box contents. Use the field's exact namespace and key, as shown where the field is defined in your Shopify admin. If the variant has the field, its value prints; otherwise the product's does. A template can use as many custom fields as you need.

{{#each line_items}}
  <tr>
    <td>{{this.title}}</td>
    <td>{{lookupBin this "location.bin"}}</td>
  </tr>
{{/each}}

The editor's Variables list shows your store's fields under Product custom fields and Variant custom fields, each named as you named it in Shopify. Formatted text (rich text) prints as plain text: paragraphs and list items each go on their own line, and links print as their words.

Quote variables#

A quote prints a Shopify draft order (see Print quotes from draft orders). Most order variables above work on a quote: the draft number is {{order.name}}, and the money, addresses, line items, company and customer fields read the draft, in the currency the customer will pay in. A draft has no payment received, balance, tip, fulfillment, tracking or sales channel, so those are empty, and the editor's Variables list for a quote leaves them out. It also doesn't list your store's custom fields from recent orders, but it does list your product and variant custom fields, which print on a quote's line items too.

Variable Shows
{{order.invoice_url}} Shopify's checkout link for the draft, where the customer reviews and pays. Empty when the draft has none. {{qrCode order.invoice_url}} prints it as a QR code
{{order.draft_status}} open, invoice_sent or completed
{{order.converted_order_name}} The order a completed draft became, such as #1047. Empty otherwise
{{quote.valid_until}} The draft's date plus the template's Valid for (days), in your store's date format. Custom quote templates use 30 days unless their settings say otherwise. Empty when no days are set
{{order.has_shipping_line}} True when the draft has a shipping line, even free shipping. Use {{#if order.has_shipping_line}} to print a Shipping row, and {{#if order.shipping_cost_raw}}{{order.shipping_cost}}{{else}}Free{{/if}} inside it
{{customer.company_name}} The buyer's business on a B2B draft. Empty otherwise. {{company.name}} is always your own store

Pick slip variables#

A pick slip is one document for every selected order, so a custom pick slip uses its own variables. The order, address, customer, money, shipping, and store custom fields above are empty on a pick slip; the editor's Variables list shows only these. See Pick Slips.

Variable Shows
{{strategy}} by_product (one list, the same item added up across orders) or by_order (one block per order)
{{batch.order_count}} Orders on the pick slip. Fully fulfilled orders drop out
{{batch.total_units}}, {{batch.line_count}} Units left to pick, and distinct items to pick
{{batch.date_range}} The order dates covered, in your store's timezone
{{company.name}}, {{company.logo_url}} and the other company fields Your company details, as above
{{settings.pickStationLabel}} Your pick station label
{{#if settings.showCheckColumn}}, showSku, showProductImages, showOrderBreakdown, showSignoffBand Display options. Inside a loop, write @root.settings.showSku

One block per order: loop with {{#each orders}} … {{/each}}. Inside it: {{this.order_name}}, {{this.created_at}}, {{this.po_number}}, {{this.amazon_order_id}}, {{this.ship_by_date}}, {{this.priority}}, {{this.total_quantity}} (units left to pick on that order), and {{#each this.line_items}} for its items. With a format chosen under Settings → Language and format, {{this.created_at_raw}} and {{this.ship_by_date_raw}} hold the ISO dates for the date helpers.

One list for the whole batch: loop with {{#each aggregated_items}} … {{/each}}. Each item's {{#each this.order_breakdown}} lists the orders that need it, with {{this.order_name}} and {{this.quantity}}.

Items, in either loop: {{this.title}}, {{this.product_title}}, {{this.variant_title}}, {{#each this.options_with_values}} (each option's {{this.name}} and {{this.value}}), {{this.sku}}, {{this.quantity}} (units still to ship), {{this.image_url}}, and {{this.tags}} for hasTag.

The helpers below work too, except resolveBarcode and lookupBin. A pick slip carries no prices, so the money helpers (formatCurrency, formatPrice) have nothing to format. formatQuantity works with pick quantities: {{formatQuantity this.quantity @root.batch.total_units "qty_of_total"}} prints "5 of 25".

Helpers#

Show something only sometimes#

  • {{#if order.po_number}} … {{else}} … {{/if}} shows a block only when the value is set, with an optional fallback
  • {{#ifNotEmpty order.note}} … {{/ifNotEmpty}}
  • {{#ifEquals a b}} … {{/ifEquals}}
  • {{#ifPositive order.balance_due_raw}} … {{/ifPositive}} shows a block only when a number is above zero, such as a balance the customer still owes (when you owe the customer a refund, the balance is below zero)
  • {{#if (hasTag this.tags "fragile")}} … {{/if}} checks a product tag

Format values#

Helper Does
{{formatCurrency amount}} Formats money in the order's currency
{{formatPrice amount currency}} Formats money with its currency code. In the classic format it prints the symbol and the code, such as £108.00 GBP. Once you choose a format under Settings → Language and format, the code takes the symbol's place, such as GBP 108.00 or 1.234,50 EUR. Pass the order's currency: {{formatPrice order.total_price_raw order.currency}}. If you leave the currency out, the classic format uses USD; a chosen format uses the order's currency
{{formatDate isoString}} A date
{{formatDateTime isoString}} Date plus 24-hour time, such as 7/7/2026 18:45. Use {{formatDateTime order.created_at_raw}} for the exact order time
{{formatDateOffset isoString days}} A date some days later, such as a return-by date
{{formatQuantity this.quantity @root.total_quantity "qty_of_total"}} A line's quantity out of the order's total units, such as 2 of 5, inside the line items loop. Use "qty_only" to print just the quantity
{{multiply a b}}, {{addOne index}} Simple math
{{removePrefix value "PO-"}} Strips a prefix
{{formatPhone value}} Formats a North American phone number as 555-123-4567. A +1 country code is dropped, and so is a 1 written on its own, as in 1-555-123-4567. Any other number is left exactly as entered

Dates and times always use your store's timezone, set in Shopify admin under Settings → General. They print in the date format from Settings → Language and format: 10/6/2026 in the current US format, 06/10/2026 for the United Kingdom, 6.10.2026 for Germany.

formatDate and formatDateOffset accept an ISO date, such as {{order.created_at_raw}}, or a date already in your store's format, such as {{order.created_at}}. So {{formatDateOffset order.created_at 30}} prints the date 30 days after the order. For the exact order time, use {{formatDateTime order.created_at_raw}}.

{{formatPhone order.phone}} formats the checkout phone, and {{formatPhone order.custom.Recipients_Phone_Number}} formats an order attribute (the same helper works on shipping_address.phone, customer.phone, or any other text). (555) 123-4567, 555.123.4567, +1 555 123 4567, and 1-555-123-4567 all print 555-123-4567. A +1 country code is dropped, and so is a leading 1 written on its own. A number written as 11 digits run together, such as 15551234567, is left as entered, because it may be another country's number. A number with a different country code stays as written, so +44 20 7946 0958 prints +44 20 7946 0958. An extension (555-123-4567 x12), a value with letters, or a number of any other length is also left as entered. An empty value prints nothing.

Barcodes and codes#

Helper Does
{{barcode value}} A barcode from a value, such as order.name
{{resolveBarcode path this}} Looks up a value by its variable path, such as "order.name", to feed a barcode
{{qrCode url}} A QR code from any link or text
{{lookupBin this "location.bin"}} Reads a variant or product custom field (metafield) inside the line items loop, such as a bin location: the variant's field first, then the product's. See Product and variant custom fields. Not available on pick slips.

Barcodes use the Code 128 format, which covers letters, numbers, and the symbols on a standard keyboard. A value with accented or non-Latin letters, such as café, prints no barcode.

Need a variable that is not here? Email support@autoprinter.app and tell us which Shopify field you need.

Did this help?

Still stuck?

Use the Need help? button inside Autoprinter, or email support@autoprinter.app. Average response time: one business day.

Related articles

  • Custom Templates

    Design your own documents: change the layout, add images and branding, and pull in live order data.

  • Customize a built-in template

    Every switch and option on the built-in packing slip, invoice, receipt, return slip, gift receipt, pick slip, and general document.

  • Multi-Location Printing

    Print each location's part of a split order separately, on the printer at that location.