Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to add a custom .product metafield to packing slip template

How to add a custom .product metafield to packing slip template

Amir212
New Member
5 0 0

Hi,

I'm trying to add

product.metafields.custom.weight

to my line item description section in packing template manually.

 

The goal is to display the weight of a sold item under its name and picture on the slip.

 

I understand metafields need a loop to be added, tried some of the suggested loops in the forum and it didn't work.

 

Any suggestions please?

Replies 8 (8)

ZenoPageBuilder
Shopify Partner
1052 203 229

You can show the metafield with this code

{{ product.metafields.custom.weight | metafield_tag }}
Zeno Page Builder - Build responsive & SEO-optimized Landing pages, Blog posts, Product pages and more...
Learn more at zenobuilder.com
Amir212
New Member
5 0 0

Thank you for your reply, but it didn't work.

 

From what I read it has to be a loop, but can't get the right loop for this one.

Liam
Community Manager
3108 344 904

Hi Amir212,

 

It doesn't look like product metafields are supported on packing slips yet, but I've passed on this request to our internal dev team.

 

Thanks for your feedback!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

hyperborea
Visitor
1 0 1

Any update on this or workaround?

Liam
Community Manager
3108 344 904

Hi Hyperborea - there's no update just yet.

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Amir212
New Member
5 0 0

Hello,

There're two ways to work around this that worked for me:

1- Adding variants to your products which will show on the packing slips (this worked for me perfectly).

2- Using "Wizard Labs: Invoice Wizard" app which enables you to add metafields to slips, but the only problem was that ALL fields will be displayed and it has very limited customization on the appearance (either display all or none).

Greg_R_
Shopify Partner
11 0 3

I know this is an old thread and comes up in google when searching on this issue, I have custom product metafield and order metafield data on my packing slips for a while now. so I thought I would update this post for the future to help those in need out

 

 

In my packing slip I have, the following code which shows an optional PO number on the packing slip. this is just an order metafield called custom.po_number under Order metafield definitions

Screenshot 2024-08-10 114912.jpg

{% if order.metafields.custom.po_number != blank %}
<p class="text-align-right">PO Number: {{ order.metafields.custom.po_number }}</P>
{% endif %}

 

and I also have a custom bin location set for all my variants

Screenshot 2024-08-10 115118.jpg

 

In my packing slip I have the following code

 

{% for item in order.line_items %}
{% if item.sku == line_item.sku %}
{% assign bin_location = item.variant.metafields.my_fields.bin_location %}
{% endif %}
{% endfor %}


Bin/Location: <b>{{ bin_location }}</b>



This has been working now over a year, so I hope this helps someone in the future

tjadie901
Visitor
2 0 0

hi!

I'm trying to replicate your bin_location coding for something similar. I have the variant metafield created and have attempted similar code to yours in my packing slip template but it never prints.

Can you possibly show me where in your packing slip template you've placed this code?