Adding Custom META fields to Packing Slip

cotty
Excursionist
22 0 7

Hi,

Trying to custom META fields to the packing slip (bin location of product in warehouse).

Currently, I'm adding is next to SKU:

 

 

              <span class="line-item-description-line">
                {{ line_item.sku }} | Bin Location: {{ product.metafields.my_fields.bin }}
              </span>

 

 

 

Here's how I setup the meta field:

Screenshot 2021-09-28 at 16-58-10 LEDSpace ~ Product metafield definitions ~ Shopify.png

 

Here's the current result (I'm expecting a bin location to show where the red underlining is):

result.png

Am I warm or way off with getting to the result I need? 

Replies 35 (35)

MamounZater
Tourist
3 0 1

I am waiting the answer ,I have done the same ,but no result!

cotty
Excursionist
22 0 7

@MamounZaterlet me know if you find a way in the meantime. I feel like I've tried everything, but probably missing something incredibly obvious.

MamounZater
Tourist
3 0 1

still searching for solutions !

I will let you know once I knew

 

Anto_S
Shopify Partner
148 4 19

If bin locations on a packing/picking slip are what you need, you could see if this solution works for you on Sheet Master https://apps.shopify.com/sheet-master (currently free).

You can set up custom warehouse bin locations, and generate pick lists in custom formats - happy to help with a free custom setup in case you need it.  Video demo: https://www.youtube.com/watch?v=O12azLZcmjo

Anto_S_0-1635780900589.png

 

Automating Commerce at Comstack.co
Email: anto@comstack.co
Zac4
New Member
4 0 0

Are you available to hire for some packing slip customization? I have 2 checkout questions and if possible shipping method id like to add. If they wont let us is there another form with more variables I could change to a packing slip? Pondmegastore@yahoo.com thank you

Prisc9
New Member
5 0 0

Hi,

 

I would need the answer to this as well. Anyone ? 🙂

Thanks !

VincentP
Visitor
1 0 0

I have used the same logic... no result. What's the solution?

Laken2244
Visitor
1 0 1

I'm trying to figure this out now! Desperately need this to work!

playcode3
Tourist
9 0 2

 Same, can't find a solution. I googled like crazy, nothing works. I want to add a "location" product metafield I created so that I can add it to the Packing slip to each product making it easier to pull the product from my bins and racks.

You can not solve your problems with the same level of thinking that created them.

bzys
Visitor
2 0 0

We are trying to do the same exact thing. We ran into a roadblock after finding that the product object (which should contain the metafields) is not available from within the line_item field within the custom packing slip Liquid.

 

https://help.shopify.com/en/manual/shipping/setting-up-and-managing-your-shipping/packing-slips-vari...

 

 

binneywood
Tourist
3 0 3

Have the same problem, just seems impossible 😞

basilkhan
Shopify Partner
40 0 5

Hi @cotty,

 

Your code looks good, but since product or variant metafields aren't accessible in the Shopify packing slips, I would recommend using Order metafields. The Freshly app, which is mostly used for lot/batch tracking, can also be used for adding bin locations for each product in the order.  

 

Here's a quick demo I made to show how to add the bin locations for each product on the Shopify packing slip: 🎥 https://www.loom.com/share/a949c18c1b544f579cd8cc2a3de1c442

 

basilkhan_0-1655225270321.png

To summarize: 

  1. Add bin locations as the batch name in product batches with a high quantity and no expiry date in Freshly
  2. Enable order metafields in Freshly preferences.
  3. Modify the template for the Shopify packing slip. I have included the template here: https://gist.github.com/basilkhan05/a94ee86cf6fe3ae7887da0348c79dd1d

And you should be all set! You can also use Freshly packing slips to do the same where you wouldn't need to rely on Shopify metafields being up-to-date with the recently updated bin locations. Let me know if you have any other questions or reach out to our team at hello@getfreshly.io🙂

Co-founder and Product Developer at Freshly Commerce ️ | Building Simple Bundles, Simple Discounts, and Freshly Inventory

cartparts
Tourist
4 0 2

Try {{ line_item.product.metafields.my_fields.bin }}

 

Here is what I use that works:
<span class="line-item-description-line">
{% assign barcode = nil %}
{% for item in order.line_items %}
{% if item.sku == line_item.sku %}
{% assign barcode = item.variant.barcode %}
{% assign notes = item.product.metafields.descriptors.subtitle %}
{% endif %}
{% endfor %}
{% if barcode != blank %}
OTHER: <b>{{ barcode }}</b><br>
{% endif %}
{% if notes != blank %}
NOTES: <b>{{ notes }}</b>
{% endif %}
</span>

Greg_R_
Shopify Partner
9 0 3

any chance you can expand on this solution, I tried your code and was unable to get any of it to work

cartparts
Tourist
4 0 2

Certainly.  

I use that code in the packing slip template which can be found and edited in the Shipping and delivery settings.  If a product on the packing slip has information in its barcode section or in the subtitle section (This is a meta field that we use), it will be displayed on the packing slip.  If there is no information in one or either of those sections, it will not be displayed.

Greg_R_
Shopify Partner
9 0 3

Thanks, after fooling around this morning I got it to work, had to make a few changes but got the meta field data to show after getting the correct metafield call working


metafield.jpg

<span class="line-item-description-line">
                {% for item in order.line_items %}
                {% if item.sku == line_item.sku %}
                {% assign bin_location = item.variant.metafields.my_fields.bin_location %}
                {% endif %}
                {% endfor %}
                {% if bin_location != blank %}
                BIN/LOCATION: <b>{{ bin_location }}</b>
                {% endif %}
</span>
bee33j
New Member
7 0 0

This worked for me too thanks!

paul127
Excursionist
16 1 12

On a 2.0 store, the following works for me:

 

BIN: <b>{{ line_item.variant.metafields.bin.value }}</b>

FredericVervill
Tourist
7 0 1

Hi,

 

Do you know why this is not working :

 

Shopify Bug.png

 

Thank you for your help!

Frederic Verville - Floèm
DAW01
Shopify Partner
13 0 5

Line item metafield is not available in the packing slip order template. You need to save the line item metafield as an order metafield then use it like this.

makiomilano
Excursionist
25 0 4

but where did you create the metafield? can you explain how you did it? thank you.

paul127
Excursionist
16 1 12

Quick and easy

variant-metafield.png

makiomilano
Excursionist
25 0 4

THANK YOU.

makiomilano
Excursionist
25 0 4

I tried to add the new variable to packing slip but is not working.

 

makiomilano
Excursionist
25 0 4

<span class="line-item-description-line">
{% for item in order.line_items %}
{% if item.sku == line_item.sku %}
{% assign bin_location = item.variant.metafields.custom.location %}
{% endif %}
{% endfor %}
{% if bin_location != blank %}
Warehouse Location: <b>{{ bin_location }}</b>
{% endif %}
</span>

 

makiomilano_0-1694573326781.png

 

I DID WORK ONLY FOR ONE ITEM, WHY IS NOT SHOWING THE OTHERS IF I ADD SOME INFO TOO?

DAW01
Shopify Partner
13 0 5

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

 

https://apps.shopify.com/flow

 

I will number all the steps to keep it easy.

 

1. 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.

 

2. 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.

 

3. 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.

 

4. 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 %}
 

5. 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

mmonshop
Tourist
3 0 4

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. 
Jonas33
Visitor
1 0 0

I tried and double-checked but it didn't work for me.

j-bookworms
Visitor
1 0 1

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.

makiomilano
Excursionist
25 0 4

Thank you for your reply. And one more question. Why this variable is not shown in CSV when I export. 

paul127
Excursionist
16 1 12

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.

 

makiomilano
Excursionist
25 0 4

WOW Matrixify is really good! I will take a closer look to this app. Tnx.

Renars
Shopify Partner
284 31 332

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.

Matrixify | Bulk Import Export Update | https://apps.shopify.com/excel-export-import | https://matrixify.app
paul127
Excursionist
16 1 12

My solution is for the Shopify Order Printer App.  The full packing slip tempale I use is:

 


<p style="float: right; text-align: right; margin: 0;">
{{ date | date: "%m/%d/%y" }} - {{ shipping_method.title }}<br /><br>
<span style="font-size:72px; font-family: 'Libre Barcode 39 Extended Text', cursive;">*{{ order_number }}*</span><br>
</p>

<div style="float: left; margin: 0 0 1.5em 0;" >
<img src="logo_color.jpg" style="width: 250px; height: 49px;"><br /><br />
{{ shop.address }}<br/>
{{ shop.city }} {{ shop.province_code }} {{ shop.zip | upcase }}<br/>
{{ shop.country }}
</div>

<hr />

<h3 style="margin: 0 0 1em 0;">Item Details</h3>

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>BIN</th>
<th>Quantity</th>
<th>Item</th>
<th>SKU</th>

</tr>
</thead>
<tbody>

{% assign lineitems = unfulfilled_line_items | sort: "title" %}
{% for line_item in lineitems %}
{% if line_item.fulfillable_quantity > 0 %}
<tr>
<td><b>{{ line_item.variant.metafields.bin.value }}</b></td>
<td><center>{{ line_item.quantity }}</center></td>
<td>{{ line_item.sku }}</td>
<td><b>{{ line_item.title }}</b><br>
<br> </td>
</tr>
{% else %}
{% endif %}
{% endfor %}
</tbody>
</table>
{% for line_item in unfulfilled_line_items %}
{% for p in line_item.properties %}
{% assign hidden_property = p.first | first | replace: '_', true %}
{% unless p.last == blank %}
{% if hidden_property == 'true' %}
{% else %}
{{ p.first }}:
{% if p.last contains '/uploads/' or p.last contains '/assets/' or p.last contains '/products/' %}<img style="width:450px;height:auto" src="{{ p.last }}"/>{% else %}{{ p.last | newline_to_br }}
{% endif %}
{% endif %}
{% endunless %}
<br>
{% endfor %}<br>
{% endfor %}

{% if note %}
<h3 style="margin: 0 0 1em 0;">Note</h3>
<p>{{ note }}</p>
{% endif %}

{% if shipping_address %}
<h3 style="margin: 0 0 1em 0;">Shipping Details</h3>

<div style="margin: 0 0 1em 0; padding: 1em; border: 1px solid black;">
<strong>{{ shipping_address.name }}</strong><br/>
{{ shipping_address | format_address }}
</div>
{% endif %}

<p>If you have any questions, please send an email to <u>{{ shop.email }}</u></p>


<style>
@import url('https://fonts.googleapis.com/css2?family=Libre+Barcode+39+Extended+Text&display=swap');
</style>

 

junaid_naeem
Shopify Partner
1 0 1

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 %}