Help with Newly Ordered Products collection automation

Help with Newly Ordered Products collection automation

QueenOfFashion
Visitor
3 0 0

Hi, we are looking to find a way to automatically add all products that have been ordered in the last 48 hours to a collection, and then come out again after 7 days. 

 

I tried using a scheduled workflow and getting order data, however it won't let me get the product data in the same workflow to add them to the collection. 

 

I tried also to use Order Created as a trigger, but again can't seem to get the product data from the order to add to the collection.

 

Any suggestions, please?

Replies 6 (6)

prakashVt
Shopify Partner
110 10 23

Hello @QueenOfFashion 
I think the easiest way to do it is to create a cronjob using a custom app and then it runs on every 48 hours intervals.

Let me know if you need any help from my end. 

- Did you find my response useful? Mark it as "Accepted solution"; so others can see it, or just like it.
- VTN Checkout Plus Looking for a Checkout App for your store? Check this app for all Shopify Plans.
- Feel free to Contact me
QueenOfFashion
Visitor
3 0 0

Hi

 

Apologies for my ignorance but what do you mean by 'cronjob' and which custom app? 

Ideally I am looking for ways to do this on Flow.

 

Many thanks, 

Sue

prakashVt
Shopify Partner
110 10 23

The requirement you have cannot be achieved by the Flow app. You need a custom solution where a cron job (a function of code that runs in set interval) will run every 7 days to fetch the order data and update the given collection.

I have done similar thing for a client. Let's connect so I can explain you better. 
@QueenOfFashion 

 

- Did you find my response useful? Mark it as "Accepted solution"; so others can see it, or just like it.
- VTN Checkout Plus Looking for a Checkout App for your store? Check this app for all Shopify Plans.
- Feel free to Contact me

paul_n
Shopify Staff
1150 142 273

So probably the way to do this would be:

  • Order created
  • Add products to collection
  • Set product metafield with an expiration date
  • Wait 7 days
  • If product metafield date = same
    • Remove products from collection

 

The metafield is needed because otherwise you won't know when a product has been ordered, and the same product could be ordered more than once in that time window. 

 

You might be able to do this with schedules as well, but I think that logic for that is much more complicated.


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.
QueenOfFashion
Visitor
3 0 0

Thanks Paul however when going straight from order created to adding products, an error flags to say there is a get data step missing.

I had a lot of issues adding multiple actions when having that data step there. 

I thought I had cracked it as follows:

 

Order Created - Get Product Data - For Each - Add to Collection

 

It says it has worked successfully but nothing added to the collection. 

 

Frustrating!!

 

 

paul_n
Shopify Staff
1150 142 273

You don't need "Get product data" but you do need the For each loop. Basically, you would loop over the order / lineItems right after the trigger. 

 

The reason you get 0 results is you likely didn't have the right query set up for "Get product data"

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.