Skip to main content

Metafields support in Order Printer Templates

Explains how support for metafields is handled in the Order Printer Templates

David Rosero avatar
Written by David Rosero
Updated this week

Our Order Printer Templates don't have a setting for metafields in the editor, nor a code to support those by default. Given the dynamic nature of metafields (varying namespaces and keys), there is no straightforward snippet that will work in a general case, since we need to know in advance which namespaces or keys will be needed.

Order Printer by Shopify

Even though our templates don't have any default code for metafields, if you're using Order Printer by Shopify, you can add those manually in the code using their documentation for reference: shopify.dev/docs/api/liquid/objects/metafield.

In summary, you’d generally use this structure:

{{ object.metafields.namespace.key }}

Where object is a Shopify object with metafields assigned, for example:

  • customer

  • order

  • line_item.variant

  • line_item.product

The metafields is part of the syntax required to fetch metafields from the selected object.

The namespace would be the metafield grouping, to prevent conflicts.

And the key would be the metadata name.

Now, where do you get these values from?

Metafields can be added in different ways. Here are two ways you can inspect these values from your store settings, depending on the source:

Custom Metafields

Metafield definitions can be added by the staff from Shopify settings under Admin Settings > Custom Data. After defining them, you’ll find the spot to fill in the values in the admin's lower section of a product/customer/order view:

For meta fields added from Shopify, use “custom” for the namespace and retrieve the key from the metafield definition in the settings.

{{ line_item.product.metafields.custom.spanish_title }}

App Metafields

However, some metafields are added by apps of new Shopify features, meaning there will be varied definitions for the namespace. So you must inspect those by adding /metafields.json to the object you’re inspecting:

{{ line_item.product.metafields.mm-google-shopping.google_product_category }}

⚠️ Metafields connected to MetaObjects won't work with these methods.

Order Printer Pro by Shop Circle

Metafields are currently not supported in Order Printer Pro. You can read more about this here: Metafields support in Order Printer Pro.

Have additional questions? Please do get in contact with our support team using the message icon on the lower right corner of this page.

Did this answer your question?