Shopify API Query For Fulfilled Orders

- 1 answer

I am creating a shopify app that queries the store for orders. The intention is to get BOTH unfulfilled and fulfilled orders; if you go to the orders tab of your store, I need to have returned all of the orders that are listed there. However, my current code will only return orders which are NOT fulfilled.

The query in question is as follows in Ruby on Rails:

@orders = Shopify_API::Order.find(:all)

I have even tried using a params of fullfillment_status: "any", which is the default indicated at so it shouldn't be necessary, but there was no change.

What am I not understanding or missing with this? If a fulfilled order is no longer considered a viable order or something, how do I go about querying for them anyway?

Thank you.



You need to organize yourself better. Here are some tips based on what works well for me.

  1. set up pagination. using :all returns 50 records at most. That means sending in a value of page, and a limit (250).
  2. ask for unfulfilled orders in a loop and process them
  3. ask for fulfilled orders in a loop and process them

That about covers it. The fulfillment status is 'unshipped' for the unfulfilled, which is super intuitive eh?

page = 1
orders = []
status = { fulfillment_status: 'unshipped', status: 'open',     financial_status: 'paid', limit: 250 }
count = ShopifyAPI::Order.count(status)
puts "Found #{count} UNSHIPPED OPEN PAID orders..."
if count > 0
  page += count.divmod(250).first
  while page > 0
    status.merge!({ page: page })
    orders += ShopifyAPI::Order.all(params: status)
    page -= 1