Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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:
Thanks,
Chelsea
Hi! No, I never got it sorted!
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.
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.
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
would something like this work for adding "final sale" to a line item that is part of a specific tag or collection?
@DAW01 Hi,
The step #3:
"type is multi line text."
-> It gives an error when adding multi-line text (because the metafields are single-line)
When I changed Flows multi-line to -> single line = it works
I can see SKU + shelf location in packing slip:
"EDD-502 | A36"
"EDD-502" Is the product's SKU & A36 is the location – which I entered on the product page (admin)
I think this doesn't work if you use other packing slips (3rd party logistic service) than Shopify's own?
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024