Re: Flow to add a newly published product to the top of a collection

Flow to add a newly published product to the top of a collection

signofastruggle
Excursionist
17 0 4

Hello!

 

I would like to create a flow to move a product to the top of a tag based collection when the product is published to online store.

 

I cannot find a simple way to do this. Some notes:

 

  • Products are not published to the online store in the order they are created. Some products are not published to the online store for months after being created. This means we cannot sort the collection by "Newest to oldest"
  • All products are currently Active as they are published for Point of sale

 

Replies 10 (10)

lilyliward
Shopify Staff
19 1 9

Hello,

 

There is a template "Add products with a tag to a collection in the future" you should be able to find in your store. It may be a good start to help you do what you want to do. 

 

Screenshot 2023-10-25 at 6.22.48 PM.png

If it doesn't help, maybe I misunderstand your problem. Perhaps you could explain a bit more. 

To learn more visit the Shopify Help Center or the Community Blog.

signofastruggle
Excursionist
17 0 4

Hello, thank you for your reply. Our collection is based on a product tag, so all products with the tag are in the collection. I would like a flow that adds a product to the top of a New Arrivals collection when a product is published on the online store.

 

Some further notes:

  • Products are not published to the online store in the order they are created. Some products are not published to the online store for months after being created. This means we cannot sort the collection by "Newest to oldest"
  • All products are currently Active as they are published for Point of sale, so running a flow for status change from draft to active will not work.

 

Kalen_Jordan
Shopify Partner
758 34 135

You'd probably need to use the manual sort option for the collection in conjunction with the collectionReorderProducts mutation. How many products do you have in that collection roughly?

SuperstellarPG
Visitor
3 0 0

Hello,

 

We are facing the exact same issues with the way Shopify is using the newest to oldest sorting in collections. Not using the published date, but the creation date is frustrating so say the least. We also have all products on active for POS reasons,.

 

Did you manage to find a solution for this yet?

paul_n
Shopify Staff
1339 151 310

The answer is along the lines of what Kalen posted. After you add the product to the collection you need to use Send HTTP Request to call the API to update the order. collectionReorderProducts is the name of mutation to call: https://shopify.dev/docs/api/admin-graphql/latest/mutations/collectionReorderProducts

 

For it to work, your collection should be manually sorted

 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
SuperstellarPG
Visitor
3 0 0
Thank you Paul.


I'm not sure what would be the trigger here to start the flow? As there is
no 'published at' trigger.

Also, how would I automate the collection and product ID data to send in
the webhook?

paul_n
Shopify Staff
1339 151 310

My assumption here is that you are using Flow to add a product to a collection, so you would just place the API call after that action. 

 

I'm not sure of your exact use case then, so you need to provide more detail on when you need to change the sort order.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
SuperstellarPG
Visitor
3 0 0
Hi Paul,


Thank you for taking the time to help me.

In our case we have set up automated collections, so not using flow to add
a product to a collection (we have a lot of them).

What we want is that whenever a product receives media (at least 1), and
has available stock, thus a new item in the online store, it gets pushed to
the first position of every collection it falls in.

Is that doable with Flow?


paul_n
Shopify Staff
1339 151 310

I don't think you can change the sort order on an automated collection. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Kalen_Jordan
Shopify Partner
758 34 135

Yeah you should be able to change the sort order on an automated collection if it has manual sort order enabled by using the collectionReorderProducts mutation.