How do you sort line items in Order Printer by a Meta field

How do you sort line items in Order Printer by a Meta field

paul127
Excursionist
18 1 13

We have added Bin Locations to our Invoice/Pick sheet via a variant meta field and would like to sort the line items by the Bin.

 

Using code from another post, I was able to sort by the Line Item Product title (blue bold). But I have exhausted every permutation I can think of to insert the custom meta field (bold green) into the code. Any suggestions or help?

 

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

Replies 2 (2)

skiller1
Shopify Partner
10 0 3

Hi Paul,

 

I have the same issue and have a developer try many things to get this to work. It seems that it is not possible and Shopify support have confirmed this. The solution from Shopify support is to create your own app where the order can be exported and sorted by your app and re-imported into order printer. I did not try this. 

At the moment , we are trying to add alphabet letters to our location Numbers and add it to the tiltle and sort that way. Still experimenting with this. Also Numbers stored as a string will sort completely differently than if they were stored as an Integar as far as I know.

If this last experiment fails, we are going to create a simple Desktop app that will get the orders via the api and sort the way we want and then print to a printer.

Steven

RichardEP
Tourist
5 0 3

Hi Steven and @paul127 

I was wondering if either of you had been able to get the result you are after? I'm wanting to do the same thing with the latest Order Printer App that has been released.

Have you been trying to get this to work with the new app or the legacy app?

Thanks