how do i sort the invoices created in order printer by sku?

how do i sort the invoices created in order printer by sku?

Matt_Dubinsky
Excursionist
27 0 11

I am trying to make it so that the shopify order printer ap will list my invoice items in alphabetical order by sku so that my order pulling takes less time than it would with the current order, which i think is just the order that the customer added the items to their shopping cart

 

please see image here to see how it makes the invoice now

 

sk2.jpg

 

so what i would want in this example is for AMZ-2 then BCA-19 then BCA-20 and all their associated values to be listed from top to bottom in alphabetical order

 

here is my current code for this section of the page here:

 

code.jpg

 

would greatly appreciate any help with this

 

Thanks!

Reply 1 (1)

jinh
Visitor
2 0 0
<tbody>    
     {% assign sorted_line_items = line_items | sort: "sku" %}
    {% for line_item in sorted_line_items %}
             <td>{{ line_item.quantity }}</td>
             <td><b>{{ line_item.title }}</b></td>
             <td>{{ line_item.sku }}</td>
             <td>{{ line_item.price | money }}</td>
      </tr>      
    {% endfor %}
  </tbody>