Sort collections by CREATED_AT
pmironov opened this issue · 1 comments
pmironov commented
Hi, I am developing an app that is using Storefront API.
I need to retrieve all collections using GraphQL query sorted desc by date of their creation (or simply put - newest created collections should be at the top of the list). Also my app requires paging so I call for 10 items per API call.
My query is
query {
shop {
name
collections(first: 10, sortKey:UPDATED_AT, reverse: true) {
edges {
cursor
node {
id
title
}
}
}
}
}
Is there any way I can sort collections not by UPDATED_AT time but by CREATED (as I can see in ProductCollectionSortKeys)? Can sorting by ID help me achieve that behavior?
Thanks.
rebeccajfriedman commented
I believe that sorting by ID will achieve the same thing.