All things Shopify and commerce
I have a 'Deals' page made from 'deals' tag -> 'deals' automated collection.
So the condition for the collection is
1. title doesn't contain 'used' - we have 'Refurbished' page separately, so excluded the used item
2. Compare at price > 0
3. Compare at price not empty
So Deals collections shows only the sales items, but when I set the product sort to be 'newest' it shows recently created items first.
We schedule sale price to be on/off, but mostly those are not newly created items. So new sales items don't show up on top even though the sale just started.
I need to have a product sort option something like 'newest - update'.
I looked into Flow, but there's no option to manipulate collection list. My theme doesn't support that kind of feature.
How can I achieve this?
Hi,
Update Metafield with Custom Code - You can use Shopify's admin API or Storefront API with a custom script that updates last_updated metafield whenever sale price changes.
Script example
{% assign sorted_products = collection.products | sort: 'metafields.namespace.last_updated' %}
{% for product in sorted_products %}
<!-- Your code to display products -->
{% endfor %}
Hello,
Thank you for your help first of all.
I'm trying to implement this by liquid code, but looks like there's some restrictions.
I added a metafield and added your code a bit edited, but the sort by metafield part doesn't work now.
I searched Perplexity, and Copilot to ask if it's possible to sort by metafield, but both said it's not possible.
Have you tried this way and it worked or do you know any work around instead of using the liquid on this?
Thank you!
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025