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

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?

{% assign items = line_items | sort: "title" %} {% for line_item in items %} {% endfor %}
{{ line_item.quantity }}X {{ line_item.product.featured_image | img_url: 'thumb' | img_tag }}
{{ line_item.title }} {{ line_item.product.type }}
1 Like