How can I sort and print orders by product type in ascending order?

How can I sort and print orders by product type in ascending order?

SaiNath
Visitor
1 0 1

Hello,

 

I am trying to print orders having their products sorted in ascending order by product type. Below is the simple code but it does not accept product.type. Code does sort if I use title, sku, quatity etc.  But not as per type. Any suggestion how to do it?

 

<table class="table-tabular" style="margin: 1.5em 1.5em 1.5em 1.5em 0;">

<tbody>
{% assign items = line_items | sort: "title" %}
{% for line_item in items %}
<tr>
<td>{{ line_item.quantity }}X </td>
<td>{{ line_item.product.featured_image | img_url: 'thumb' | img_tag }}<b><br /><td>
<td>{{ line_item.title }}</td>
<td>{{ line_item.product.type }}</td>
</tr>
{% endfor %}

</tbody>
</table>

Replies 0 (0)