Thank you for your reply!! Thankfully I did figure it out after some grinding and I’ll post what I did to achieve that:
The flow was pretty simple in theory but took quite a while figuring out the value code for a single line text for order.metafields.stock.bin :
{% assign output = ‘’ %}{% for item in order.lineItems %}{% for mf in item.variant.metafields %}{% if mf.namespace == ‘stock’ and mf.key == ‘bin’ and mf.value != blank %}{% assign output = output | append: item.sku | append: ‘:’ | append: mf.value | append: ‘,’ %}{% endif %}{% endfor %}{% endfor %}{{ output | remove_last: ‘,’ | strip_newlines | strip }}
That code make a single line text look like this in the order metafield: CM343001:bin #1,17-0761:bin #2,45-0761F:bin #3,44-SSE13:bin #4
That then gets read by the packing slip template code via this section:
{% assign all_pairs = order.metafields.stock.bin | split: “,” %}
{% assign matched_bin = “” %}
{% assign current_sku = line_item.sku | strip %}
{% for pair in all_pairs %}
{% assign pair = pair | strip %}
{% assign parts = pair | split: “:” %}
{% assign pair_sku = parts[0] | strip %}
{% assign pair_bin = parts[1] | strip %}
{% if pair_sku == current_sku %}
{% assign matched_bin = pair_bin %}
{% endif %}
{% endfor %}
{% if matched_bin != “” %}
Bin Location: {{ matched_bin }}
{% else %}
Bin Location: Not assigned
{% endif %}
Then it makes the packing slips look like this (I had put in some random things to test):
OEM Aprilia Passenger Seat Cowl Matte Black
CM343001
Bin Location: A64
Woodcraft Sidestand Elimination Plug
44-SSE13
Bin Location: something
Woodcraft Top Triple Clamp
17-0761
Bin Location: Space Space
Woodcraft Front Axle Sliders
45-0761F
Bin Location: 12345567965465165