Liquid variables and filters reference for Shopify Order Printer
You can use Liquid to build your own custom templates using the Shopify Order Printer app. With Liquid, you can create text templates and render them based on each order's unique data.
The liquid references listed on this page are an extension of the the open-source version of Liquid and are meant to be used on the Shopify Order Printer app. To render information based on order and shop attributes, you can use the list of objects, tags, and filters from this reference to customize the your templates. You can also use the Admin GraphQL API docs to learn details about object fields.
On this page
Using variables and attributes
In the Shopify Order Printer templates, the core data objects are order and shop. You can use order.variable_name to access the order attributes.
The following commonly used order attributes are accessible without the order. prefix:
line_itemstax_linesfulfillmentstransactionsdiscountsrefundsshipping_methodscustomer
For example, if you want to access the line items variable, you can use line_items or order.line_items.
Liquid variables available in Shopify Order Printer
The following classes are available. Attributes are listed in the alphabetical order.
Order
The following Order attributes are available in Shopify Order Printer:
attributesb2bbilling_addresscancel_reasoncancel_reason_labelcancelledcancelled_atcart_level_discount_applicationscheckout_idcheckout_payment_collection_urlcompanycompany_locationconfirmation_numbercreated_at. The time when the order has been processed. This is equal toorder.processed_atfrom the GraphQL API. Use thedatefilter to format the timestamp, for example with{{ order.created_at | date: "%B %e, %Y" }}.customerdiscounts. Deprecated because not all discount types and details are captured. Theorder.discountsproperty has been replaced byorder.discount_applications.discounts_amount. Deprecated because not all discount types and details are captured. Theorder.discountsproperty has been replaced byorder.total_discounts.discount_applicationsdiscounts_savings. Deprecated because not all discount types and details are captured. Theorder.discountsproperty has been replaced by-.emailfeesfinancial_statusfinancial_status_labelfulfilled_line_itemsfulfillment_abortedfulfillment_statusfulfillmentsgatewayiditem_countlanding_sitelanding_site_refline_itemsline_items_subtotal_pricelocationmetafieldsnamenet_paymentnoteorder_nameorder_numberorder_status_urlpaymentpayment_detailspo_numberrefundsrequires_shippingshipping_addressshipping_methodshipping_methodsshipping_priceshopshop_namesubtotal_pricetagstax_linestax_pricetip_line_itemstotal_discountstotal_dutiestotal_landed_cost_additional_feestotal_net_amounttotal_outstandingtotal_pricetotal_refunded_amounttotal_tiptransactionsunacceptable_risksunfulfilled_line_itemsunique_gatewaysuservoid_transactions
Shop
Review the following list of Shop attributes that are available in Shopify Order Printer:
accepts_gift_cardsaccount_ownerallows_discountscheckoutcheckout_requires_confirmation_stepcollections_countcontact_informationcurrencycustomer_accounts_enabledcustomer_accounts_optionaldescriptiondomainemailemail_accent_coloremail_logo_urlemail_logo_widthemail_marketingenabled_currenciesenabled_localesenabled_payment_typesfeaturesidlatitudelegal_noticelongitudemetafieldsmoney_formatmoney_with_currency_formatnamepassword_messagepermanent_domainphonepoliciesprivacy_policyproducts_countrefund_policysecure_urlshipping_policysubscription_policyterms_of_saleterms_of_servicetypesurl
LineItem
Review the following list of Line Item attributes that are available in Shopify Order Printer:
aggregated_updateapplied_discounts. Deprecated because not all discount types and details are available. Theline_item.discountsproperty has been replaced byline_item.discount_allocations.current_quantitydiscount_allocationsdiscounts. Deprecated because not all discount types and details are available. Theline_item.discountsproperty has been replaced byline_item.discount_allocations.final_line_pricefinal_pricefulfillmentfulfillment_servicegift_cardgramsgroupsidimageindexitem_updatesjson_filterkeyline_level_discount_allocationsline_level_total_discountline_price. Deprecated because discounts from automatic discounts and discount codes aren't included. Theline_item.line_priceproperty has been replaced byline_item.final_line_price.messageoptions_with_valuesoriginal_line_priceoriginal_priceprice. Deprecated because discounts from automatic discounts and discount codes aren't included. Theline_item.priceproperty has been replaced byline_item.final_price.productproduct_idpropertiesquantityrefunded_quantityrequires_shippingselling_plan_allocationskusuccessfully_fulfilled_quantitytax_linestaxabletitletotal_discount. Deprecated because discounts from automatic discounts and discount codes aren't included. Theline_item.total_discountproperty has been replaced byline_item.line_level_total_discount.unit_priceunit_price_measurementurlurl_to_removevariantvariant_idvendor
Fulfillment
Review the following list of Fulfillment attributes that are available in Shopify Order Printer:
created_at. Use thedatefilter to format the timestamp, for example with{{ fulfillment.created_at | date: "%B %e, %Y" }}.estimated_delivery_atfulfillment_line_itemsitem_countline_itemsrequires_shippingtracking_companytracking_numbertracking_numberstracking_urltracking_urlsupdated_at
Address
Review the following list of Address attributes that are available in Shopify Order Printer:
address1address2citycompanycountrycountry_codecountry_uppererrorsfirst_nameidlast_namenamephoneprovinceprovince_codestreetsummarytranslated_country_nametranslated_province_nameurlzip
Customer
Review the following list of Customer attributes that are available in Shopify Order Printer:
accepts_marketingaccount_activation_urladdressesaddresses_countb2b?default_addressemailfirst_namehas_accountidlast_namelast_ordermetafieldsnamenew_addressordersorders_countpayment_methodsphonereset_password_urlsubscribe_urltagstax_exempttotal_spent
DiscountApplication
Review the following list of DiscountApplication attributes that are available in Shopify Order Printer:
target_selectiontarget_typetitletotal_allocated_amounttypevalue_typevalue
Printing discounts
Discounts can be applied to the entire order or to specific line items:
- Order level discounts: They apply to the entire order. You can display these discounts separately at the bottom when printing your order invoice.
- Line item level discounts: They apply to individual items. You can mention these discounts when printing individual item details in the line item section.
You can access the discounts information using the following variables:
- Access all discounts applied to the order or any of its line items with the
order.total_discountsvalue andorder.discount_applicationscollection. - Access line item discounts with the
line_item.line_level_total_discountvalue orline_item.line_level_discount_allocationscollection. - Access the line item price as it was before applying any discounts with the
line_item.original_pricevalue. - Access the line item resulting price after applying all related line item level discounts with the
line_item.final_pricevalue. - The
line_item.original_line_priceandline_item.final_line_pricevalues are equal to theline_item.original_priceandline_item.final_pricevalues multiplied byline_item.quantity. - Access order level discounts with the
order.cart_level_discount_applicationscollection.
Example code block for printing line item level discounts:
{% for line_item in order.line_items %}
<tr>
<td>{{ line_item.quantity }}</td>
<td>{{ line_item.title }}
{% if line_item.line_level_discount_allocations.size > 0 %}
<span class="subduedText">
{% for discount_allocation in line_item.line_level_discount_allocations %}
<br>{{ discount_allocation.discount_application.title }} (-{{ discount_allocation.amount | money }})
{% endfor %}
</span>
{% endif %}
</td>
<td style="text-align: right;">
{% if line_item.original_price != line_item.final_price %}
<span class="subduedText"><s>{{ line_item.original_price | money }}</s></span>
{% endif %}
{{ line_item.final_price | money }}
</td>
</tr>
{% endfor %}Example code block for printing order level discounts:
{% for discount_application in order.cart_level_discount_applications %}
<tr>
<td colspan="2" style="text-align: right;">{% if discount_application.title %}<span class="subduedText">{{ discount_application.title }}</span>{% endif %}</td>
<td style="text-align: right;">-{{ discount_application.total_allocated_amount | money }}</td>
</tr>
{% endfor %}- Learn more about discount types and working with discounts in Liquid.
DiscountAllocation
Review the following list of DiscountAllocation attributes that are available in Shopify Order Printer:
amountdiscount_application
Discount
Review the following list of Discount attributes that are available in Shopify Order Printer:
amountcodefree_shipping_discountidsavingstitletotal_amounttotal_savings
Product
Review the following list of Product attributes that are available in Shopify Order Printer:
as_jsonavailablecollectionscompare_at_pricecompare_at_price_maxcompare_at_price_mincompare_at_price_variescontentcreated_atdescriptionfeatured_imagefeatured_mediafirst_available_variantgift_card?handlehas_only_default_variantidimagesjson_filtermediametafieldsobject_typeoptionsoptions_by_nameoptions_with_valuespriceprice_maxprice_minprice_variespublished_atrequires_selling_planselected_or_first_available_selling_plan_allocationselected_or_first_available_variantselected_selling_planselected_selling_plan_allocationselected_variantselling_plan_groupstagstemplate_suffixtitletypeurlvariantsvendor
Variant
Review the following list of Variant attributes that are available in Shopify Order Printer:
as_jsonavailablebarcodecompare_at_pricefeatured_imagefeatured_mediaidimageincominginventory_managementinventory_policyinventory_quantityjson_filtermetafieldsnext_incoming_dateoption1option2option3optionspriceproductrequires_selling_planrequires_shippingselected_selling_plan_allocationselling_plan_allocationsskustore_availabilitiestaxabletitleunit_priceunit_price_measurementurlweightweight_in_unitweight_unit
Refund
Review the following list of Refund attributes that are available in Shopify Order Printer:
amountcreated_atidnoterefund_line_itemsrestocktransactions
ShippingLine
Review the following list of Shipping Line attributes that are available in Shopify Order Printer:
handleidoriginal_priceprice. Deprecated because the price did not include order level discounts. Theshipping_line.priceproperty has been replaced byshipping_line.price_with_discounts.price_with_discountstax_linestitle
TaxLine
Review the following list of Tax Line attributes that are available in Shopify Order Printer:
priceraterate_percentagetitle
Transaction
Review the following list of Transaction attributes that are available in Shopify Order Printer:
amountbuyer_pending_payment_instructionsbuyer_pending_payment_noticecreated_atgatewaygateway_display_nameidkindnamepayment_detailsreceiptshow_buyer_pending_payment_instructionsstatusstatus_label
Metafield
A metafield attached to a parent object. To learn about how to access a metafield on a specific object, refer to Access metafields.
Metafields support multiple data types, which determine the kind of information that's stored in the metafield. To access metafields, the access path for metafields consists of two layers:
- namespace - a grouping of metafields to prevent conflicts,
- key - the metafield name.
Given this, you can access the metafield object with the following syntax: {{ resource.metafields.namespace.key }}.
Naming: <object>.metafields.<namespace>.<key>. For example, order.metafields.shipping.express_delivery_status.
Types:
StringArray- use[ ]to index. For example,order.metafield.shipping.express_delivery_status[0]IntegerBooleanDate
Note Metaobject type isn't supported.
Objects that support metafields:
OrderCustomerProductVariantLocation
Liquid filters available in Shopify Order Printer
Usage
To apply filters to an output, add the filter and any filter parameters within the output's curly brace delimiters {{ }}, preceded by a pipe character |. In the example below, product is the object, title is its property, and upcase is the filter being applied:
{{ product.title | upcase }}If product.title has the Health potion value, HEALTH POTION will be the output from the upcase filter.
Refer to the Filters section from the Shopify Themes Liquid reference for details on how to use Liquid filters.
Filters to be applied on Address objects
format_address
For usage examples, refer to the Shopify Themes Liquid documentation for format_address.
Filters to be applied on any text / string
camelcasecamelizeencode_url_componentformat_codehandlehighlightpad_spacesparagraphizepluralizeurl_escapeurl_param_escape
For usage examples, refer to the Shopify Themes Liquid documentation for string filters.
Filters to be applied on money-meaning numbers
moneymoney_with_currencymoney_without_currencymoney_without_trailing_zeros
Shopify Order Printer uses the email notifications currency formatting options configured in the Shopify admin for formatting money.
You can change the currency formatting. Set the Email with currency and the Email without currency values in the Shopify admin to change the money filters formatting in the Shopify Order Printer.
For usage examples, refer to the Shopify Themes Liquid documentation for money filters.
Filters to be applies to convert objects to json
json
For usage examples, refer to the Shopify Themes Liquid documentation for json filters.
Filters to be applied on weight-meaning numbers
weightweight_with_unit
For usage examples, refer to the Shopify Themes Liquid documentation for weight with unit.
Filters to be applied on tags
highlight_active_taglink_to_add_taglink_to_remove_taglink_to_tag
For usage examples, refer to the Shopify Themes Liquid documentation for tag filters.
Filters to be applied on urls
article_img_urlasset_img_urlasset_urlcdn_asset_urlcollection_img_urlfile_img_urlfile_urlglobal_asset_urlimage_urlimg_tagimg_urllink_topayment_icon_png_urlpayment_type_img_urlpayment_type_svg_tagplaceholder_svg_tagproduct_img_urlscript_tagshopify_asset_urlstylesheet_tag
For usage examples, refer to the Shopify Themes Liquid documentation for media and html filters.
Filters to be applied on collections
link_to_typelink_to_vendorsort_byurl_for_typeurl_for_vendorwithin
For usage examples, refer to the Shopify Themes Liquid documentation for collection filters.