Metafields use on Invoices with Order Printer

Shopify Partner
16 0 2

We have successfully created and populated 40,000 products with a custom field (metafield) 'warehouse location code' but note we cannot print that warehouse location code on an invoice (using the Shopify App Order Printer). According to the variables available to print, Metafields are not included???

Does anyone have a work around? This seems to be a serious flaw in an otherwise great invoice creation tool.

0 Likes
Shopify Partner
16 0 2

For anyone that is interested here is the work around to have metafield data (custom fields) placed onto an invoice or picking slip with Order Printer. In our case we already had a custom field (metafield) setup called custom_fields.warehouse_code which was populated with information for each product.

1/ On your product.liquid page find the <form action="/cart/add"> tag and insert the following code within the form tags:

{% if product.metafields.custom_fields.warehouse_code %}
       {% assign warehouse-code = product.metafields.custom_fields.warehouse_code %}
{% endif %}
                          
<input id="warehouse-code" type="hidden" name="properties[_Warehouse Code]" value="{{ warehouse-code }}">

2/ On your Order Printer template insert the following code where you wish the custom field data (metafield data) needs to display:

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

Hope this helps someone else.

1 Like
New Member
1 0 0

To create an invoice in a specific language, its unique language code has to be added as additional order information. View Epson Error Code 0xf1 to know about printer errors.

0 Likes
New Member
2 0 0

Unfortunately, I couldn't find any 

<form action="/cart/add">

on the product.liquid page in my store. Did something change in the last 2 1/2 years? Does somebody know how to fix this or if there is a better method by know?

 

Thanks in advance,

Niklas 

0 Likes
Highlighted
Shopify Expert
158 0 39

Try the product template in the sections folder. It's probably in that file.

Head fox at Elkfox | App and web, design and development | Digital commerce experts | https://elkfox.com
0 Likes
New Member
1 0 0

Hey,

 

I am also struggling with finding this line. It isn't in the product.template either. Is this workaround not good anymore?

 

Cheers,

Will

 

0 Likes
Shopify Expert
158 0 39

This should still work just fine. I'd recommend hiring an expert to help with it if you aren't an experienced Shopify themes developer.

Head fox at Elkfox | App and web, design and development | Digital commerce experts | https://elkfox.com
0 Likes
Excursionist
26 0 1

Thanks @Adam_Robson 

 

Do you know how to get this information (variant's metafields) in order printer if you create the order in the dashboard? 

 

Thanks

0 Likes