Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I am trying to create an api query that will grab all orders within the last 7 days. However, I cannot figure this out. I have found repeated examples of grabbing orders using created_at. But that does not appear to work as I'd need to enter specific dates.
When I go to my dashboard on Shopify, I can grab orders within the last week and this is the url for that:
/admin/orders?inContextTimeframe=today&processed_at=past_week
I have been unsuccessful in getting this to work in an api query and am curious if anyone knows a way.
What *exactly* did you try in your api query?
I just tested this GraphQL query
{
orders(first: 99, query: "processedAt:>=past_week") {
edges {
node {
name
processedAt
}
}
}
}
at https://shopify.dev/graphiql/admin-graphiql
and I also tried also using the same query with curl on my shop locally and it worked in my tests.
This shall only return the 99 orders of last week, I believe he wants if there were 99+ orders, what should be done. It shall require to keep query the pagination. (And I am also exploring this as well~)