As of Commerce 2.2 line items are ordered by date created.
How can you order line items differently?
{% for item in cart.lineItems.orderBy(’sku desc') %}
does not work…
I am posting the answer of Craft Commerce Support in case somebody stumbles over the same thing:
It is possible to order them differently if required. The code example below shows how to order them alphabetically by SKU.
{% set lineItems = cart.lineItems|sort((a, b) => a.sku <=> b.sku) %}
<ul>
{% for item in lineItems %}
<li>{{ item.description }} - [{{ item.sku }}]</li>
{% endfor %}
</ul>
Thanks Nathaniel