-->

Shopify API: Get Orders In Shopify by Date

2019-08-24 02:00发布

问题:

Why fetching Orders from Shopify Store by date and limits always returns the orders of latest date? like: if I make a query for getting 5 orders from 1 august 2012 using this query: /admin/orders.json?status=open&created_at_min=2012-08-01 12:00&limit=5

As I have 5 orders in 20 August 2012 and 5 orders in 31 August 2012 but this will returns 5 orders of latest date (31 August 2012).

回答1:

The Shopify API returns orders from Most Recent to Oldest.

When you submit your query Shopify will first create an array of your ten orders; the first five are from 31 August, the last 5 are from 20 August.

Then, by limiting it to five orders, Shopify gives you the first five.

As far as I'm aware, there is no way to specify your own sort order in the Shopify API. You'll need to get all the orders with created_at_min= 2012-08-01 then, using whatever language you're writing in, get the last 5 items in the array.



回答2:

It's not documented, but you can do it by adding: order=processed_at+asc to your query.



回答3:

&created_at_max=2012-08-01 11:59 does the trick

shopify order api



回答4:

for bettween two dates

/admin/orders.json?created_at_min=2012-08-01 12:00&limit=2012-08-01 12:00