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.

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_items
  • tax_lines
  • fulfillments
  • transactions
  • discounts
  • refunds
  • shipping_methods
  • customer

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:

  • attributes
  • b2b
  • billing_address
  • cancel_reason
  • cancel_reason_label
  • cancelled
  • cancelled_at
  • cart_level_discount_applications
  • checkout_id
  • checkout_payment_collection_url
  • company
  • company_location
  • confirmation_number
  • created_at. The time when the order has been processed. This is equal to order.processed_at from the GraphQL API. Use the date filter to format the timestamp, for example with {{ order.created_at | date: "%B %e, %Y" }}.
  • customer
  • discounts. Deprecated because not all discount types and details are captured. The order.discounts property has been replaced by order.discount_applications.
  • discounts_amount. Deprecated because not all discount types and details are captured. The order.discounts property has been replaced by order.total_discounts.
  • discount_applications
  • discounts_savings. Deprecated because not all discount types and details are captured. The order.discounts property has been replaced by -.
  • email
  • fees
  • financial_status
  • financial_status_label
  • fulfilled_line_items
  • fulfillment_aborted
  • fulfillment_status
  • fulfillments
  • gateway
  • id
  • item_count
  • landing_site
  • landing_site_ref
  • line_items
  • line_items_subtotal_price
  • location
  • metafields
  • name
  • net_payment
  • note
  • order_name
  • order_number
  • order_status_url
  • payment
  • payment_details
  • po_number
  • refunds
  • requires_shipping
  • shipping_address
  • shipping_method
  • shipping_methods
  • shipping_price
  • shop
  • shop_name
  • subtotal_price
  • tags
  • tax_lines
  • tax_price
  • tip_line_items
  • total_discounts
  • total_duties
  • total_landed_cost_additional_fees
  • total_net_amount
  • total_outstanding
  • total_price
  • total_refunded_amount
  • total_tip
  • transactions
  • unacceptable_risks
  • unfulfilled_line_items
  • unique_gateways
  • user
  • void_transactions

Shop

Review the following list of Shop attributes that are available in Shopify Order Printer:

  • accepts_gift_cards
  • account_owner
  • allows_discounts
  • checkout
  • checkout_requires_confirmation_step
  • collections_count
  • contact_information
  • currency
  • customer_accounts_enabled
  • customer_accounts_optional
  • description
  • domain
  • email
  • email_accent_color
  • email_logo_url
  • email_logo_width
  • email_marketing
  • enabled_currencies
  • enabled_locales
  • enabled_payment_types
  • features
  • id
  • latitude
  • legal_notice
  • longitude
  • metafields
  • money_format
  • money_with_currency_format
  • name
  • password_message
  • permanent_domain
  • phone
  • policies
  • privacy_policy
  • products_count
  • refund_policy
  • secure_url
  • shipping_policy
  • subscription_policy
  • terms_of_sale
  • terms_of_service
  • types
  • url

LineItem

Review the following list of Line Item attributes that are available in Shopify Order Printer:

  • aggregated_update
  • applied_discounts. Deprecated because not all discount types and details are available. The line_item.discounts property has been replaced by line_item.discount_allocations.
  • current_quantity
  • discount_allocations
  • discounts. Deprecated because not all discount types and details are available. The line_item.discounts property has been replaced by line_item.discount_allocations.
  • final_line_price
  • final_price
  • fulfillment
  • fulfillment_service
  • gift_card
  • grams
  • groups
  • id
  • image
  • index
  • item_updates
  • json_filter
  • key
  • line_level_discount_allocations
  • line_level_total_discount
  • line_price. Deprecated because discounts from automatic discounts and discount codes aren't included. The line_item.line_price property has been replaced by line_item.final_line_price.
  • message
  • options_with_values
  • original_line_price
  • original_price
  • price. Deprecated because discounts from automatic discounts and discount codes aren't included. The line_item.price property has been replaced by line_item.final_price.
  • product
  • product_id
  • properties
  • quantity
  • refunded_quantity
  • requires_shipping
  • selling_plan_allocation
  • sku
  • successfully_fulfilled_quantity
  • tax_lines
  • taxable
  • title
  • total_discount. Deprecated because discounts from automatic discounts and discount codes aren't included. The line_item.total_discount property has been replaced by line_item.line_level_total_discount.
  • unit_price
  • unit_price_measurement
  • url
  • url_to_remove
  • variant
  • variant_id
  • vendor

Fulfillment

Review the following list of Fulfillment attributes that are available in Shopify Order Printer:

  • created_at. Use the date filter to format the timestamp, for example with {{ fulfillment.created_at | date: "%B %e, %Y" }}.
  • estimated_delivery_at
  • fulfillment_line_items
  • item_count
  • line_items
  • requires_shipping
  • tracking_company
  • tracking_number
  • tracking_numbers
  • tracking_url
  • tracking_urls
  • updated_at

Address

Review the following list of Address attributes that are available in Shopify Order Printer:

  • address1
  • address2
  • city
  • company
  • country
  • country_code
  • country_upper
  • errors
  • first_name
  • id
  • last_name
  • name
  • phone
  • province
  • province_code
  • street
  • summary
  • translated_country_name
  • translated_province_name
  • url
  • zip

Customer

Review the following list of Customer attributes that are available in Shopify Order Printer:

  • accepts_marketing
  • account_activation_url
  • addresses
  • addresses_count
  • b2b?
  • default_address
  • email
  • first_name
  • has_account
  • id
  • last_name
  • last_order
  • metafields
  • name
  • new_address
  • orders
  • orders_count
  • payment_methods
  • phone
  • reset_password_url
  • subscribe_url
  • tags
  • tax_exempt
  • total_spent

DiscountApplication

Review the following list of DiscountApplication attributes that are available in Shopify Order Printer:

  • target_selection
  • target_type
  • title
  • total_allocated_amount
  • type
  • value_type
  • value

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_discounts value and order.discount_applications collection.
  • Access line item discounts with the line_item.line_level_total_discount value or line_item.line_level_discount_allocations collection.
    • Access the line item price as it was before applying any discounts with the line_item.original_price value.
    • Access the line item resulting price after applying all related line item level discounts with the line_item.final_price value.
    • The line_item.original_line_price and line_item.final_line_price values are equal to the line_item.original_price and line_item.final_price values multiplied by line_item.quantity.
  • Access order level discounts with the order.cart_level_discount_applications collection.

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 %}

DiscountAllocation

Review the following list of DiscountAllocation attributes that are available in Shopify Order Printer:

  • amount
  • discount_application

Discount

Review the following list of Discount attributes that are available in Shopify Order Printer:

  • amount
  • code
  • free_shipping_discount
  • id
  • savings
  • title
  • total_amount
  • total_savings

Product

Review the following list of Product attributes that are available in Shopify Order Printer:

  • as_json
  • available
  • collections
  • compare_at_price
  • compare_at_price_max
  • compare_at_price_min
  • compare_at_price_varies
  • content
  • created_at
  • description
  • featured_image
  • featured_media
  • first_available_variant
  • gift_card?
  • handle
  • has_only_default_variant
  • id
  • images
  • json_filter
  • media
  • metafields
  • object_type
  • options
  • options_by_name
  • options_with_values
  • price
  • price_max
  • price_min
  • price_varies
  • published_at
  • requires_selling_plan
  • selected_or_first_available_selling_plan_allocation
  • selected_or_first_available_variant
  • selected_selling_plan
  • selected_selling_plan_allocation
  • selected_variant
  • selling_plan_groups
  • tags
  • template_suffix
  • title
  • type
  • url
  • variants
  • vendor

Variant

Review the following list of Variant attributes that are available in Shopify Order Printer:

  • as_json
  • available
  • barcode
  • compare_at_price
  • featured_image
  • featured_media
  • id
  • image
  • incoming
  • inventory_management
  • inventory_policy
  • inventory_quantity
  • json_filter
  • metafields
  • next_incoming_date
  • option1
  • option2
  • option3
  • options
  • price
  • product
  • requires_selling_plan
  • requires_shipping
  • selected_selling_plan_allocation
  • selling_plan_allocations
  • sku
  • store_availabilities
  • taxable
  • title
  • unit_price
  • unit_price_measurement
  • url
  • weight
  • weight_in_unit
  • weight_unit

Refund

Review the following list of Refund attributes that are available in Shopify Order Printer:

  • amount
  • created_at
  • id
  • note
  • refund_line_items
  • restock
  • transactions

ShippingLine

Review the following list of Shipping Line attributes that are available in Shopify Order Printer:

  • handle
  • id
  • original_price
  • tax_lines
  • title

TaxLine

Review the following list of Tax Line attributes that are available in Shopify Order Printer:

  • price
  • rate
  • rate_percentage
  • title

Transaction

Review the following list of Transaction attributes that are available in Shopify Order Printer:

  • amount
  • buyer_pending_payment_instructions
  • buyer_pending_payment_notice
  • created_at
  • gateway
  • gateway_display_name
  • id
  • kind
  • name
  • payment_details
  • receipt
  • show_buyer_pending_payment_instructions
  • status
  • status_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:

  • String
  • Array - use [ ] to index. For example, order.metafield.shipping.express_delivery_status[0]
  • Integer
  • Boolean
  • Date

Note Metaobject type isn't supported.

Objects that support metafields:

  • Order
  • Customer
  • Product
  • Variant
  • Location

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

  • camelcase
  • camelize
  • encode_url_component
  • format_code
  • handle
  • highlight
  • pad_spaces
  • paragraphize
  • pluralize
  • url_escape
  • url_param_escape

For usage examples, refer to the Shopify Themes Liquid documentation for string filters.

Filters to be applied on money-meaning numbers

  • money
  • money_with_currency
  • money_without_currency
  • money_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

  • weight
  • weight_with_unit

For usage examples, refer to the Shopify Themes Liquid documentation for weight with unit.

Filters to be applied on tags

  • highlight_active_tag
  • link_to_add_tag
  • link_to_remove_tag
  • link_to_tag

For usage examples, refer to the Shopify Themes Liquid documentation for tag filters.

Filters to be applied on urls

  • article_img_url
  • asset_img_url
  • asset_url
  • cdn_asset_url
  • collection_img_url
  • file_img_url
  • file_url
  • global_asset_url
  • image_url
  • img_tag
  • img_url
  • link_to
  • payment_icon_png_url
  • payment_type_img_url
  • payment_type_svg_tag
  • placeholder_svg_tag
  • product_img_url
  • script_tag
  • shopify_asset_url
  • stylesheet_tag

For usage examples, refer to the Shopify Themes Liquid documentation for media and html filters.

Filters to be applied on collections

  • link_to_type
  • link_to_vendor
  • sort_by
  • url_for_type
  • url_for_vendor
  • within

For usage examples, refer to the Shopify Themes Liquid documentation for collection filters.

Can't find answers you're looking for? We're here to help you.