Order Printer Metafield

Charlie_Lawrenc
New Member
6 0 0

Trying to get Order Printer to print metafield data.

Following this forum post https://ecommerce.shopify.com/c/ecommerce-design/t/metafields-use-on-invoices-with-order-printer-360...

Changed the namespace and key but all else the same.

In product-template.liquid under <form action="/cart/add"

{% if product.metafields.pro.loc %}
       {% assign loc = product.metafields.pro.loc %}
{% endif %}
                          
<input id="loc" type="hidden" name="properties[_Location]" value="{{ loc }}">

In the Order Printer template: 

{% for line_item in line_items %}
Location: {% for property in line_item.properties %}{{ property.last }}{% endfor %}
{% endfor %}

Order Printer displays the word Location but not the value.

0 Likes
Jianu00
New Member
2 0 0
Have you solved the problem ??
0 Likes
martinp
New Member
1 0 0

Hi,

Anyone wanting to display custom metafield in order template, here is code which works:

{% for line_item in line_items %}

{% assign cnum = line_item.product.metafields.cnbr.value %}

<p>{{ cnum }}</p>

{% endfor %}

Value for cnbr should be already added for your custom product metafield to display the value.

0 Likes