Migrating your templates from the Order Printer app to Shopify Order Printer

If you have any custom templates in the legacy Order Printer app, then you need to migrate your templates to the Shopify Order Printer app.

To migrate your templates, you can import your existing templates to the Shopify Order Printer app. However, the new Shopify Order Printer app has a slightly different implementation than the legacy Order Printer app. This means that some of your existing templates might not work initially and you might need to make some adjustments to your template's code.

To make your templates work in the new app, you need to replace the legacy variables with the new variables. For example, if you use the date variable, then you need to replace with it the created_at variable.

On this page you can find a list of variables that you might need to replace with new variables in the Shopify Order Printer app.

Considerations for migrating your existing templates

Before you migrate your existing templates to the Shopify Order Printer app, review the following considerations:

Migrate your existing templates to the Shopify Order Printer app

If you have existing templates from the legacy Order Printer app, then you can import them to the Shopify Order Printer app. You can't import specific templates, you can only import all your templates at same time.

Steps:

  1. From your Shopify admin, click Settings > Apps and sales channels.
  2. Click Order Printer.
  3. Click Open app.

  4. Click Templates.

  5. Click Import

  6. In the dialog, click Import.

  7. Review whether your templates uses any of the legacy variables, and then replace them with the new variables.

  8. Preview your templates and make sure that the templates display correctly.

  9. Optional: Print test documents.

Using order variables in the Shopify Order Printer app

Order variables are used differently in the Shopify Order Printer app. To access order variables, you need to add the order. prefix. For example, to access the billing_address variable, you need to use order.billing_address.

The following commonly used order variables are accessible without the order. prefix:

  • line_items
  • tax_lines
  • fulfillments
  • transactions
  • refunds
  • shipping_methods
  • customer

For example, if you want to access the line items variable, you can use line_items or order.line_items.

You can also make your own aliases for your template. For example, you can use the {% assign fulfillments_count = order.fulfillments | size %} Liquid syntax, and then reference it by using {{ fulfillments_count }} in your code.

Variable mapping

The Shopify Order Printer app uses different variables to the legacy Order Printer app. If your existing templates use any of the variables listed in this section, then you need to replace your old variables with new variables.

For example, if you use the date variable, then you need to replace it with the created_at variable.

Order variables

Order variable
Variable in the legacy Order Printer appVariable in the new Shopify Order Printer app
line_items
  • Refunded line items aren't included in the line_items variable. Review the following details:
    • You can access refunded line items using the refunds.<each>.refund_line_items variable. Review the following example.
      {% assign refunded_line_items = refunds | map: "refund_line_items" | map: "line_item" %}
    • You can join the refunded line items to the line_items collection if you want to. Review the following example.
      {% assign refunded_line_items = order.refunds | map: "refund_line_items" | map: "line_item" %} {% assign line_items_with_refunded = order.line_items | concat: refunded_line_items | uniq %}
    • You should ensure that you include the | uniq filter in order to avoid duplication of the refunded line items.
  • Tip line items aren't included in the line_items variable. Review the following details:
    • You can access tip line items using the tip_line_items variable.
    • You can join tip_line_items to the line_items collection if you want to. Review the following example.
      {% assign line_items_with_tips = order.line_items | concat: order.tip_line_items %}
  • To mimic the legacy Order Printer line_items collection, you can use the following example code.
    {% assign refunded_line_items = refunds | map: "refund_line_items" | map: "line_item" %} {% assign all_line_items = order.line_items | concat: refunded_line_items | concat: order.tip_line_items | uniq %} {% for line_item in all_line_items %} ... {% endfor %}
credit_cardUse payment details based on each transaction from the order with the transactions.<each>.payment_details variable.
current_shipping_priceshipping_price
dateUse the created_at variable. Use the date filter to format the timestamp, for example with {{ order.created_at | date: "%B %e, %Y" }}.
gateways unique_gateways or transactions.<each>.gateway
order_currencycurrency
processed_atUse the created_at variable. It holds the value of order.processed_at from the GraphQL API, and it means the actual time that the order is processed at, rather than the time that the order is imported into Shopify. It is the same as order.processed_at from the legacy Order Printer app. You can use the date filter to format the timestamp, for example with {{ order.created_at | date: "%B %e, %Y" }}.
payment_transactions

Filter through order.transactions for the kind status in the Liquid syntax with where, or with looping and an if inside. Review the following examples.

{% assign sale_transactions = order.transactions | where: "kind", "sale" %} {% assign capture_transactions = order.transactions | where: "kind", "capture" %} {% for transaction in transactions %} {% if transaction.kind == "sale" or transaction.kind == "capture" %} Transaction ID: {{ transaction.id }} Kind: {{ transaction.kind }} Amount: {{ transaction.amount | money }} {% endif %} {% endfor %}

{% assign sale_transactions = order.transactions | where: "kind", "sale" %} {% assign capture_transactions = order.transactions | where: "kind", "capture" %} {% assign payment_transactions = sale_transactions | concat: capture_transactions %}

refund_transactionsFilter through order.transactions for the kind status in the Liquid syntax with where, or with looping and an if inside, as with the following example.
{% assign refund_transactions = order.transactions | where: "kind", "refund" %}
shipping_lineshipping_methods | first
shipping_linesshipping_methods
show_line_item_taxes tax_lines.size > 0. You can define it as a variable in the beginning of the template and refer to it multiple times, as with the following example.
{% if tax_lines.size > 0 %} {% assign show_line_item_taxes = true %} {% else %} {% assign show_line_item_taxes = false %} {% endif %}
total_taxtax_price
total_paidnet_payment

LineItem variables

LineItem variable
Variable in the legacy Order Printer appVariable in the new Shopify Order Printer app
fulfillable_quantityquantity - successfully_fulfilled_quantity
fulfilledquantity == successfully_fulfilled_quantity
nametitle
product_titleproduct.title
unit_discountquantity ? line_level_total_discount / quantity : 0
variant_titlevariant.title
weightgrams

Fulfillment variables

fulfillment variable
Variable in the legacy Order Printer appVariable in the new Shopify Order Printer app
datecreated_at

Shop variables

Shop variable
Variable in the legacy Order Printer appVariable in the new Shopify Order Printer app
owneraccount_owner.name
addressshop.address.address1
address2shop.address.address2
cityshop.address.city
countryshop.address.country
country_codeshop.address.country_code
provinceshop.address.province
province_codeshop.address.province_code
zipshop.address.zip

Address variables

Address variable
Variable in the legacy Order Printer appVariable in the new Shopify Order Printer app
latitudeIf the address variable was referenced from the location atrribute, then the latitude and longitude are available on the location object itself.
longitudeIf the address variable was referenced from the location atrribute, then the latitude and longitude are available on the location object itself.

Refund variables

Refund variable
Variable in the legacy Order Printer appVariable in the new Shopify Order Printer app
dateUse the created_at variable. Use the date filter to format the timestamp, for example with {{ order.created_at | date: "%B %e, %Y" }}.

ShippingLine variables

ShippingLine variable
Variable in the legacy Order Printer appVariable in the new Shopify Order Printer app
current_priceprice
priceoriginal_price

Transaction variables

The following transaction variables were removed and can't be replaced in the Shopify Order Printer app:

  • authorization
  • message
  • test

Variant variables

variant variable
Variable in the legacy Order Printer appVariable in the new Shopify Order Printer app
gramsweight

Metafield variables

To access a metafield, you need to specify the metafield's Namespace, and don't need to add the .value to the variable. Learn more about metafield definitions.

For example, instead of product.metafields.manufacturerid.value variable, use product.metafields.custom.manufacturerid variable.

To identify Namespace values for each metafield, refer to the Custom data page in your Shopify admin. Metafield definitions are grouped by the objects they refer to, such as products, variants, or orders.

Filter mapping

Filter mapping
Filter name in the legacy Order Printer appFilter name in the new Shopify Order Printer app
files_urlfile_url
payment_method and payment_methods Use the transaction.gateway_display_name field on order transactions. Payment methods are no longer categorized into specific types, such as {credit card, debit card, bank transfer}. The legacy Order Printer app mapped only a small subset of currently functioning payment gateways to these categories. Payment gateway providers manage the types of payment methods used by customers on their side.
Can't find answers you're looking for? We're here to help you.