Guide
How to print line item properties from Shopify orders
Updated
Line item properties hold what a shopper types on the product page, such as a gift message, a name to engrave or a delivery date. Shopify saves them with the item, but a packing slip prints them only if its template asks for them. Here’s how they work, the Liquid that prints them, and why one might not show.
Short answer
Line item properties are what a shopper types on the product page, such as a gift message or a name to engrave, saved with that item in the order. To print them, loop over line_item.properties in your packing slip or Order Printer template, and skip names that start with an underscore.
What line item properties are
A field on the product page, added by your theme or an app, has a name such as properties[Gift message]. When the shopper adds the item to the cart, what they typed goes with it, and Shopify saves it with that item in the order: a name, Gift message, and a value, the message itself.
<input type="text" name="properties[Gift message]">On the order page, the properties show under their item. Two of the same product with different properties become separate lines, so each gift keeps its own message.
Properties that start with an underscore
Shopify hides a property from shoppers at checkout when its name starts with an underscore. Apps use these for their own data: Noteable, for example, saves _noteable_template_id with each item, so it knows which card design to print.
They’re still saved with the order, and your templates can read them, so skip them when you print. The snippets on this page do.
Print them on the packing slip
Shopify’s packing slip template has each item’s properties as line_item.properties. Each one has a name, property.first, and a value, property.last.
- Open the template. In your Shopify admin, go to Settings › Shipping and delivery and click Packing slip template in the Documents section. If Documents lists your document templates instead, click your packing slip template.
- Find the item loop. It starts with
{% for line_item in line_items_in_shipment %}. Paste the snippet inside it, under the item’s title. - Preview, then save. Preview the template, save it, and print the packing slip for an order whose items have properties.
{% for property in line_item.properties %}
{% assign first_char = property.first | slice: 0 %}
{% if property.last != blank and first_char != "_" %}
<p>{{ property.first | escape }}: {{ property.last | escape | newline_to_br }}</p>
{% endif %}
{% endfor %}It prints each property that has a value, one per line, as its name and value. escape prints characters such as < just as the shopper typed them, and newline_to_br keeps their line breaks.
Print just one property
To print one property, such as the gift message, and leave the others off, compare each name with the one you want. Use the name exactly as it shows on the order page, capitals and spaces included.
{% for property in line_item.properties %}
{% if property.first == "Gift message" and property.last != blank %}
<p><strong>Gift message:</strong> {{ property.last | escape | newline_to_br }}</p>
{% endif %}
{% endfor %}Change both Gift messages to your property’s name, the one in quotes to match it and the one in bold as its label on the slip.
In Shopify Order Printer
Shopify Order Printer’s templates have the same line_item.properties, but their item loop is {% for line_item in order.line_items %}, so paste either snippet inside that loop. Print from an order with More actions › Print with Order Printer, or select several orders on the Orders page and print them together.
In order notifications
Notification templates, such as the order confirmation, can print properties too. In your Shopify admin, go to Settings › Notifications and open the template. Shopify’s notification variables have each item’s properties as line.properties. Look for them in the template’s item loop before you add anything: the template may print them already.
Why a property doesn’t print
Open the order and look under the item first.
- It’s under the item, but not on the slip. The template doesn’t print properties yet, or its loop skips this one. Add the snippet inside the item loop, and if you print just one property, check that the name matches.
- Its name starts with an underscore. The snippets skip those on purpose: they’re an app’s own data.
- It isn’t under the item. It was never saved with the item. Shopify saves properties from fields inside the product form, so a field that sits outside the form never reaches the order.
- It’s under Notes or Additional details. It was saved for the whole order, as the order note or a cart field, not as a property. The packing slip can print the note but not Additional details: see How to print the gift message on your Shopify packing slip.
- You edited the other template. Shopify’s packing slip and Shopify Order Printer have separate templates, so add the snippet to the one you print.
Where this stops
The slip prints properties in its own layout and font, on plain paper. To print them on your own card design instead, Noteable’s block collects the entries on your product page, saves them as line item properties, and prints them on your PDF. It prints the entries its own block collects, not other apps’ properties. To compare the two, read Noteable vs Shopify Order Printer for gift messages.
Questions
What are line item properties in Shopify?
Entries saved with one item in an order, each a name and a value, such as “Gift message: Have the best day.” Shoppers fill them in on the product page, in fields your theme or an app adds, and they show under the item on the order page.
Why do some line item properties start with an underscore?
An underscore at the start of a property’s name hides it from shoppers at checkout. Apps use these properties for their own data, such as Noteable’s _noteable_template_id. They’re still saved with the order, so skip them when you print.
Why isn’t my line item property showing on the packing slip?
If it shows under the item on the order page, the packing slip template doesn’t print it yet: add a loop over line_item.properties inside the template’s item loop. If it isn’t on the order page either, it was never saved with the item, for example because the field sits outside the product form.
Can I print just one line item property?
Yes. Inside the loop, print a property only when its name matches, such as property.first == "Gift message". The name must match exactly, capitals and spaces included.
Do product options apps’ fields show on the packing slip?
If the app saves them as line item properties, the loop on this page prints them with the rest. Some apps save entries elsewhere, such as the order’s Additional details, so check where the entry shows on the order page.