Is it possible to reorder metaobjects?

rbhsiags
Shopify Partner
3 0 1

I would like my metaobject entries of a specific definition to be sorted alphabetically, so that it is more aesthetically pleasing when viewing them in, say in a metafield of type of list of metaobjects.

 

I can export the metaobjects in Matrixify and they have a column named "Row #", which gives the order of the metaobject entries as saved in Shopify. However, it doesn't seem to be possible to reorder them using Matrixify.

 

So, it there a way to reorder metaobject entries? Doesn't matter if it's from Shopify Admin or using Shopify GraphQL API.

Reply 1 (1)

MagaliWD
Shopify Partner
19 0 2

Hello, in liquid you can use :

{% assign ordered_metaobject = shop.metaobjects.your_metaobject.values | sort_natural: 'row' %}
and loop in this new ordered_metaobject