How to sort products in a collection by a custom product metafield?

I have a collection at https://lflounge.com/collections/loungefly-exclusives and every product has a custom metafield called Release Date. Is there a way that I can have the products in this collection sorted by that custom product metafield, from newest to oldest? I believe I read this is possible, but I could not locate the specific code to add/change. Thanks in advance for the assistance!

Hello @lflounge

You can do this from the admin as there is the option in the collections. You can change the sorting from there as here this dropdown appears.

https://prnt.sc/eBxJ_WMXL0kG

Thank you for the response, but the option I am looking for is not a default…I want to sort a collection based on a custom product metafield

2 Likes

I think the only way to do it would be by using a custom collection where you can set the sort order over the API. I should be able to build out an automation template for you for this if you’re interested.