Autamatic Best sellers collection

Topic summary

A user seeks to create an automatically updating “Best Sellers” collection in Shopify based on products sold in the last 30 days using the Flow app.

Proposed Solution:
One approach involves using Flow to track sales totals via product metafields, though this may face limitations with high order volumes. Another community member provides a detailed workflow:

  • Create a product metafield called “Last Purchased Date” (DateTime type)
  • Trigger on order creation
  • For each line item: add product to “Best Sellers” collection and update the metafield with order creation timestamp
  • Wait 30 days
  • Check if metafield still matches original order date; if so, remove product from collection

Implementation Challenges:
The original poster struggles with configuring the Flow workflow correctly, particularly with accessing the custom metafield value (lineItemsForeachitem.product.lastPurchaseDate.value). Screenshots show multiple attempts at setting up the conditions and actions.

Current Status:
Detailed visual guides (screenshots) are shared showing the exact Flow configuration needed. A video tutorial is also provided for step-by-step implementation. The solution remains in testing phase to verify it triggers correctly.

Summarized with AI on October 24. AI used: claude-sonnet-4-5-20250929.

Hi there! Im using the Flow app for some tagging purposes such as New Arrivals, but I cannot really figure out how to set it for Best sellers. I want to make a collection that updates based on last 30 days best selling products.

1 Like

You should be able to do this with a flow that saves a last 30 day sales total metafield to products on the order trigger - and then use that to define a collection. Depends on order volume though because flow is limited in how much data int can pull in at once.

Can you show me how this can be done as Im trying for several days now and cant figure it out?

1 Like

Sorry my ability to provide free help here is limited, but if you’re interested in help on a paid basis, the link is in my signature.

@FlashChoices - Give this a go:

First create a new Product Metafield (e.g. “Last Purchased Date”) with type Date Time.

Create new workflow as follows:

Start when: Order created

  • For each item in order.lineItems
    • Add products to collections (select “Best Sellers” Collection)
  • For each item in order.lineItems
    • Update product metafield “Last Purchased Date” with value {{order.createdAt}}
  • Wait for: 30 days
    • For each item in order.lineItems
      • Check if “Last Purhase Date” value is equal to order created at
        - Remove products from collection “Best Sellers”

Hi Robert Kanaan! Thank you for your reply! Can you show me how this needs to be done as Im trying now for 3 hours and cant figure it out.
This is what I made

1 Like

Hi @FlashChoices - sure, here’s what it looks like in Flow. Refine and test as needed.

Hi Robert! Thank you for that. Will test it right now

I have done the flow, but not sure of these 2 are correct. Could you please check on them? Thank you!

@FlashChoices Here’s a closer look at those two. Make sure your using the correct namespace and key for the date time metafield you created.

Thank you Robert! Will try to make it that way and will wait for the day to see if it triggers correctly. Thank you once again for your help!

Sorry about that but I cant really find that value lineItemsForeachitem.product.lastPurchaseDate.value. Im only reaching to lineItemsForeachitem.product. and from there I cant find the rest of it. Can you help with that? Thank you!

For this who want to see a step by step walk through of this technique I made a video. How to Create Best Seller Collections Step by Step (2025)