Adding Line Item Location to Packing Slip

ChelseaColgan
New Member
9 0 0

Hi there,

 

Does anyone have any idea what variable I would need to add to my packing slips to include the products location beside the name? I mocked up what I'm looking for quickly in photoshop so you get an idea: 

 

location.jpg

 

Thanks,

Chelsea

 

 

Replies 5 (5)

DAW01
Shopify Partner
13 0 5

Hi ChelseaColgan

 

Do you still need help with this or did you find a solution?

ChelseaColgan
New Member
9 0 0

Hi! No, I never got it sorted! 

DAW01
Shopify Partner
13 0 5

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

If this works for you please accept this as a solution.

NatFinn
Visitor
1 0 0

How are you getting variant.metafields.stock.bin as fields in the Order Metafield Namespace and key area? I try that and get 

 

"You need to use one period (.) to separate the namespace and key" 

 

And am stuck with stock.bin which creates  order.metafields.stock.bin

Mindy_Blas
Tourist
3 0 1

would something like this work for adding "final sale" to a line item that is part of a specific tag or collection?