I’m using the Dawn theme and want to add a custom sort option to the product grid. Where are these sort options taken from and where are their sort logic defined? Here are the sort options that come default with Dawn. Thanks!
I found a work-around for this. I created a “manual” colllection, then wrote a script that temoves all the products from that collection, then adds the products to the collection in a certain order, and scheduled this script to run periodically.
collection = shopify.Collect.find(handle=collection_id)
# remove all products from this collection
while True:
try:
collection_item = collection.pop()
except:
break
collection_item.destroy()
# loop over a file that defines the sort order (not shown because it's too specific to my store)
# add products to that collection
collect = shopify.Collect({ 'product_id': shopify_product_id, 'collection_id': collection_id })
collect.save()
Hi, I’m curious, how exactly did you run that script? I don’t see any interface for running custom scripts directly within the admin dashboard. Could you kindly share more details on your solution? Thanks.
