select items in cart.items with a specific property value

Hi I have the following simple liquid problem but somehow its just not working. I want to select all cart items having the property cart_ordering and its value of item_order_index.

I thought it should work with this statement:

{% assign items_with_index = cart.items | where: “properties.cart_ordering”, item_order_index %}

But the Array i get is always empty. I need this in order to show my Cart Items in self created order instead of showing them just line after line.

Best regards and i hope someone can helpt me fast :slightly_smiling_face:

You should expect to get nothing back as where would only work on root properties.

If you need to show things in a certain order with properties it may have to be handled by doing some loops instead.

Okay thank you thought it would go deeper than root elements :slightly_smiling_face: