Cancel orders not_paid after x days since order_created

Hey there,

we want to build a flow that does the following:

Checks whether an order is still unpaid
Verifies if x days have passed since the order_created date
Cancels the order if the condition is met

The second part, in particular, is something I’m struggling to implement at the moment.

We could use “Wait for x days,” but since we’ve been in the market since January, that would mean we’d only have a working flow in 21 days.

  • Scheduled time trigger (recurrence of 1 day)
  • Get order data (filtering by unpaid and created_at > x days old)
  • For each order returned:
  • Check any other condtion
  • Cancel order

Be careful that you test this before putting in a cancel order action. You can quickly mess if your store if you get the logic wrong

Thanks for your quick response! Great hint.
Since I’m not so familiar with Shopiy graphQL and dev_syntax, can you please take a look?

financial_status:unpaid AND created_at:>21

Furthermore, I would test this with creating an order tag first, checking if the tag was placed correctly and only after that starting with cancellation processes.

Thanks in advance!

unpaid is not a filter value. You might instead check if the finanical_status matches 1 or more other criteria. orders - GraphQL Admin

Look at the examples in that Get order data data for how to do the dates. Some will have a date_minus tag you may want to use.