Why does FulfillmentOrder return empty array?

Environment: Ruby 3.0.2, shopify_api version 9.5.1. [Yes I know I need to upgrade version, on our schedule but don’t have the resources to do so at the moment]

In my STAGING environment (different server, but same Ubuntu 20.04 server, same Ruby/Shopify API version) the following code works (to use the fulfillment order object):

fulfillment_orders = ShopifyAPI::FulfillmentOrder.all(params: {order_id: order_id})
puts "fulfillment_orders = #{fulfillment_orders.inspect}"

However in my production environment it fails, returning an empty array .

I’ve checked: my permissions on both stores for the app allow write_merchant_managed_fulfillment_orders, the api_version is the same:

ShopifyAPI::Base.api_version = '2021-10'

Why in production is the call to FulfillmentOrder failing and returning an empty array?

(order_id exists in both environments). Any suggestions?

Thanks.

Hi,

Probably the fulfillment orders you are interested in are being filtered out because of insufficient access scopes. Check https://community.shopify.com/c/fulfillment-api-deprecation/nothing-returned-from-the-admin-api-2022-07-orders-order-id/td-p/1983360

If you are sure this is not the case, please DM me with your shop ids in prod and staging and the order ids you query. Then, I’ll check on our side.

Michael – I “solved” the issue by moving to a straight JSON call non shopify_api method:

store_url = ApiShopify.new(brand.name).store_url
            store_header = ApiShopify.new(brand.name).get_header

            puts "store_url = #{store_url}"

            store_url = store_url + "orders/#{pfha['pick_ticket']}/fulfillment_orders.json"
            fulfillment = HTTParty.get(store_url, :headers => store_header)
            puts "-------------- fulfillment data ---------"
            puts fulfillment.inspect

            fulfillment_orders_info = fulfillment.parsed_response['fulfillment_orders'].first  

            puts "------ Shopify Fulfill Info --------"
            puts fulfillment_orders_info.inspect
            puts "-----------------------"