This worked for me too thanks!
Topic summary
The discussion centers on displaying custom product metafields (specifically warehouse bin locations) on Shopify packing slips. The original poster attempted to access product metafields directly in the packing slip template but found they weren’t rendering.
Core Challenge:
Product and variant metafields are not directly accessible in Shopify’s default packing slip templates, which limits straightforward implementation.
Working Solutions Identified:
-
Order Metafields Approach: Use order-level metafields instead of product metafields. One detailed solution involves:
- Creating variant metafields for bin locations
- Setting up corresponding order metafields
- Using Shopify Flow to automatically copy variant metafield data to order metafields when orders are created
- Modifying the packing slip template to display the order metafield data
-
Third-Party App: The Freshly app was recommended for lot/batch tracking, which can repurpose batch names as bin locations and sync them to order metafields.
-
Direct Product Reference: Some users reported success accessing metafields via
line_item.product.metafields.namespace.keysyntax, though results varied.
Current Status:
Multiple working implementations have been shared with code examples and step-by-step instructions. The consensus is that order metafields combined with Shopify Flow provide the most reliable solution for this use case.
but where did you create the metafield? can you explain how you did it? thank you.
THANK YOU.
I tried to add the new variable to packing slip but is not working.
I DID WORK ONLY FOR ONE ITEM, WHY IS NOT SHOWING THE OTHERS IF I ADD SOME INFO TOO?
This is the only way I got it to work
You need to make an order metafield with the product location information to display it on the order packing slip. You will need Shopify Flow to do this. It is free on the Shopify subscription and Shopify Advance subscription
I will number all the steps to keep it easy.
- Go to /settings/custom_data/productvariant/metafields
Make the following metafield
variant.metafields.stock.bin (stock is the namespace and bin is the key)
It must be single line text.
- Go to /settings/custom_data/order/metafields
Make the following metafield
order.metafields.stock.bin (stock is the namespace and bin is the key)
It must be single line text.
- Make the flow to that will create the order metafield
Go to Sfopify Flow. Trigger will be Order Created. Action will be Update Order Metafield.
Then enter the following
Key is bin
Metafield namespace is stock
Value is
{% for lineItems_item in order.lineItems %}{% for metafields_item in lineItems_item.variant.metafields %}{% if metafields_item.key == 'bin' and metafields_item.key != '' %},{{ lineItems_item.sku }}:Bin:{{ metafields_item.value }}{% endif %}{% endfor %}{% endfor %}
Do not make any spaces or new lines in this code or it will not work. Copy and past it as is.
Type is multi line text.
- Next you will add the code to your packing slip template.
Go to settings/ shipping and delivery /packing_slip_template, then edit.
Look for this code
{% if line_item.sku != blank %}
<span class="line-item-description-line">
{{ line_item.sku }}
{% endif %}
and replace it with this
{% if line_item.sku != blank %}
<span class="line-item-description-line">
{{ line_item.sku }}
{% assign sku_bin_pairs = order.metafields.stock.bin | split: ',' %}
{% for sku_bin_pair in sku_bin_pairs %}
{% assign sku_bin_info = sku_bin_pair | split: ':' %}
{% assign sku_info = sku_bin_info[0] %}
{% assign bin_info = sku_bin_info[2] %}
{% if sku_info == line_item.sku %}
<strong> | {{ bin_info }}</strong>
{% endif %}
{% endfor %}
</span>
{% endif %}
- Next you need to fill in the product locations. Go to each product or product variant and at the bottom you will find the metafields and the bin. Enter your location here. The location that I used did not contain any spaces, like 1A45
This will only work on new orders once the flow created the order metafield with the product location that you entered.
It will look like this on your packing slip
SKU | Location
Let me know if you need help or if it worked for you
It seems like you included in the loop, so should be ok:
{% for line_item in line_items_in_shipment %}
One item to note if bin_location is empty in the metafields it doesn’t print Warehouse Location: either. This plain text can be placed above {% if bin_location != blank %}
ps. this worked without any 3rd party apps as I tried on my own site.
Thank you for your reply. And one more question. Why this variable is not shown in CSV when I export.
I’m not sure of why, but you are correct it isn’t available on any of the Shopify exports. I have been using the Matrixify App (https://apps.shopify.com/excel-export-import) to report and import Metafileds and general data.
WOW Matrixify is really good! I will take a closer look to this app. Tnx.
Hello @makiomilano and @paul127
You sure can bulk manage Metafields with Matrixify app.
I understand that you already found the solution, but just in case anybody else stumbles on this thread - here you can find our tutorial on how to manage Shopify Metafields with the Matrixify app.
Its not working for me. I am getting this error in the Flow -
Got error updating metafield: “Value can’t be blank.” For value: “\n”, Type: multi_line_text_field
All the bins are updated in the variants as A1 , A2 etc.
I tried and double-checked but it didn’t work for me.
My solution is for the Shopify Order Printer App. The full packing slip tempale I use is:
{{ date | date: "%m/%d/%y" }} - {{ shipping_method.title }}
*{{ order_number }}*
{{ shop.address }}
{{ shop.city }} {{ shop.province_code }} {{ shop.zip | upcase }}
{{ shop.country }}
Item Details
{% assign lineitems = unfulfilled_line_items | sort: “title” %}
{% for line_item in lineitems %}
{% if line_item.fulfillable_quantity > 0 %}
| BIN | Quantity | Item | SKU |
|---|---|---|---|
| {{ line_item.variant.metafields.bin.value }} | {{ line_item.quantity }} | {{ line_item.sku }} | {{ line_item.title }} |
{% endfor %}
{% endfor %}
{% if note %}
Note
{{ note }}
{% endif %}{% if shipping_address %}
Shipping Details
{{ shipping_address | format_address }}
If you have any questions, please send an email to {{ shop.email }}
@import url('[https://fonts.googleapis.com/css2?family=Libre+Barcode+39+Extended+Text&display=swap](https://fonts.googleapis.com/css2?family=Libre+Barcode+39+Extended+Text&display=swap)');Hi, You can use this code for metafield value in Packing slips. I tried it in my code and it’s working.
{% for line_item in order.line_items %}
{% assign product = line_item.product %}
{% assign metafield_value = product.metafields.custom.article_number %}
Metafield Value: {{ metafield_value }}
{% endfor %}
i try this but value not visible
This is only working for single products it is not carrying the information down for each individual product.
Expected Value:
SKU: 1000 Bin: A12
SKU: 1001 Bin: B23
SKU: 1002 Bin: C31
Actual Value:
SKU: 1000 Bin: C31
SKU: 1001 Bin: C31
SKU: 1002 Bin: C31
Any suggestions?
This didn’t work for me…
Hey, @Nicole32
I’m not formally trained in code to provide you with an exact solution to make this coding solution for you. However, I’m confident one of our Shopify experts would be able to accomplish this at a reasonable price.
Just wanted to share this as an option in case you are unable to find a coding solution in your thread.

