Retrieving all orders

Solved
jihoro
New Member
3 0 1

I tried (in Ruby)

@orders = ShopifyAPI::Order.find(:all, params: { limit: 100 }), but it only returns unfulfilled orders.
 
So I've been trying to use the GET method but it seems to be detecting a syntax error when I do something like 
@orders = GET /admin/orders.json?status=any&fulfillment_status=any. 
 
How can I fix my code so that it returns all orders?
HunkyBill
Shopify Expert
4354 36 462

This is an accepted solution.

First off, you would be wanting to add code to your params. So you add:

  • status: 'any'
  • page
  • limit

And with that, you can ask for page 1, a limit of 250 orders, and you'll get up to 250 orders of any status. The default of fulfillment_status is any, so you do not need that. 

 

Also note that unless otherwise approved, you only get orders from the last 60 days unless you demonstrated a need for more. Most people will get a count of all orders, and then use the limit of 250 to figure out how many pages of orders they have, and then iterate through the pages to get all their orders of interest.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Meghala
New Member
2 0 0

Order number 5667 via Instagram 

0 Likes