Craft Commerce > 2.2: How can you order line items? 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) =&gt; a.sku &lt;=&gt; b.sku)  %}
&lt;ul&gt;
    {% for item in lineItems %}
        &lt;li&gt;{{ item.description }} - [{{ item.sku }}]&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;


Thanks Nathaniel