Have your say in Community Polls: What was/is your greatest motivation to start your own business?

GetOrderData for order older then X days + fullfilled

GetOrderData for order older then X days + fullfilled

RennWelten
Excursionist
29 3 4

Hi everyone,

 

I am trying to use GetOrderData to get orders older then X days + fullfilled to afterwards for example add them to a spreadsheed or simply archive them and am struggling a bit how to do it.

 

My idea is to use an advanced query but somehow I get 0 returns although there are several orders existing:

 

created_at:>='{{ scheduledAt | date_plus: "1 week" }} AND fulfillment_status:shipped

 

Help would be highly appreciated!

 

Armin

Replies 5 (5)

paul_n
Shopify Staff
1433 157 332

You want `date_minus` not `date_plus` since that would be in the future.

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.
CarmineT
Shopify Partner
96 2 28

I actually used created_at:>='{{ scheduledAt | date_minus: "2 days" }}'

 

and still get also the order from when the flow is run to -2 days.

So the better question, is possible to filter out orders that in a particular time frame, let's say:

older then 2 days but not more then 5?

paul_n
Shopify Staff
1433 157 332

You can filter by the same variable twice. So add something like created_at:>="somedate" AND created_at:<="another date"

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.
CarmineT
Shopify Partner
96 2 28

Yep, indeed I used followinf code in the advance query box of the get order data

 

created_at:<='{{ "now" | date_minus: "2 days" }}' AND
created_at:>='{{ "now" | date_minus: "8 days" }}' AND

 

My question is, as I learn that searching around and check others template, there is a doc where I can see the parameter I can use in that box.

For example the  "now" parameter does work as in popular software day() or today() etc 

using only now does not work.

 

Also having the get customer date and write a query one must use proper object parameters.

 

For example if I have the bloc get customer data, sorting by last order date,

how I know which parameters I can further query,

is this correct/ accepted because the customer order has also an updated_at field?

 

updated_at:<='{{ "now" | date_minus: "2 days" }}' AND
updated_at:>='{{ "now" | date_minus: "8 days" }}' AND

 

 

 

 

I missing are those the API of shopify GraphQL implementation or some sort of "dialect"

 

I hope my question does make sense. 

paul_n
Shopify Staff
1433 157 332

Two good references:

https://help.shopify.com/en/manual/shopify-flow/reference/variables

And https://shopify.github.io/liquid/

 

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.