Re: fulfillment_orders returns empty array no matter the order passed

fulfillment_orders returns empty array no matter the order passed

mikewa33
Visitor
2 0 5

Hi, Working on a custom app and I am trying to pull in the order fulfillment list from the Shopify API. Currently following the documentation it says to use https://shopify.dev/api/admin-rest/2022-01/resources/fulfillmentorder#[get]/admin/api/2022-01/orders... but no matter what order I pass to the endpoint it returns an empty array

Replies 16 (16)

awwdam
Shopify Staff
249 42 38

Hey @mikewa33,

I did some testing with the example fulfillment order API request you shared, on several open and unfulfilled orders in my test enviroment. In all cases was returned the expected data and found no issues. Below I have included the testing process, but would suggest reading through our fulfillment example docs that offers insights on scopes, explanation of fulfillment orders as well as process for order management vs fulfillment service applications - this one following covers migration but is a good place to start.


1.  Create an order with multiple line_items and leave the order unfulfilled, you can do this however works best for your stores configuration.
2. Using the Orders endpoint, locate that order_id:
GET https://{SHOP}.myshopify.com/admin/api/2022-01/orders.json?fulfillment_status=unfulfilled

3. Populate at into the fulfillment_orders request:
GET https://{SHOP}.myshopify.com/admin/api/2022-01/orders/{ORDER_ID}/fulfillment_orders.json


If you have the correct scopes and feel something isn't working after testing, please log the x-request-id header value we returned for the request and share it back here. With that I can take a look at our requests logs and share any insights from there!

Cheers!

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Mads_W
Excursionist
16 2 14

@awwdam 

I have a similar case, where an empty array is returned. x-request-id is: cfb118b2-9416-4074-8da3-99cc220be3df

 

Thanks!

 

Mads_W
Excursionist
16 2 14

I'll answer the question, since Shopify api support (if there is such a thing) clearly does not give a damn. (A bitterness in this post - sorry, but disappointed about not getting any help from this community, shopify support, shopify partner support, shopify launch team, shopify bug team). 

To the solution:

If you struggle with empty response/empty array on GET ..../fulfillment_orders.json, try updating permissions or creating a new private app. That helped me out.

masterperoo
Shopify Partner
4 0 1

HAhaha. Yesss

permissions on your app. 

I wasted 2 hours reading the internet and nobody had any clue. 

I thought I had permissions ok - but no now set even more - not sure which one made a the difference; guessing - 3rd party merchant something

Mads_W
Excursionist
16 2 14

Hi @mikewa33 

Did you manage to find out what went wrong? I am having same issue as you.

Thanks

Appifiny
Shopify Partner
166 2 54

I had the same issue. The reason is because the `read_merchant_managed_fulfillment_orders` or `write_merchant_managed_fulfillment_orders` access scopes have not been requested.

I did try requesting `write_assigned_fulfillment_orders` in my fulfilment app but this still just returned an empty array.

Other endpoints will throw an error if access scopes have not been granted but this endpoint confusingly just returns an empty array.

The API was limited but stable for years. There seems to be a lot of bad decision API design and bugs being introduced just lately.

Try the best recent order app for Shopify free for 7 days: https://apps.shopify.com/recently

jc25
Shopify Partner
1 0 2

Thanks @Mads_W @Appifiny, i spent hours on this one too, works perfectly now

Mads_W
Excursionist
16 2 14

Glad to help 🙂

SaadMayo
Shopify Partner
4 0 0

hi Jc25 !

Have you resolved this problem?   if yes then kindly share what's the possible solution to this problem

ClementOutis
Shopify Partner
25 4 12

@SaadMayo 
Like @Appifiny said (thanks for that), just add `read_merchant_managed_fulfillment_orders` and/or `write_merchant_managed_fulfillment_orders` access scopes worked for me  (with read_assigned_fulfillment_orders and write_assigned_fulfillment_orders scopes).

 

- Helpful? Like and Accept a solution
- Casper - Cart, sync and keep saved for a month your customer's cart across multiple device seamlessly.
- BrandCraft, give you all the keys to edit your checkout page, only for Shopify Plus with the Checkout Extensibility.

seismo
Shopify Partner
5 0 10

I first go a 401 and checked write_assigned_fulfillment_orders and read_assigned_fulfillment_orders in the permissions. Then I received the empty list. After also checking write_merchant_managed_fulfillment_orders and read_merchant_managed_fulfillment_orders it worked. So I didn't have the necessary permissions but still go a valid but empty response? Wtf shopify... No information in the docs afaik.

trosnerMSU
Shopify Partner
1 0 0

Did you ever figure out a solution? I checked over my API response object about a hundred times, confirmed I have all of the permissions, but I can't figure out why I keep receiving an empty list. Order is marked as paid, unfulfilled, and the inventory is in stock. 😞

Mads_W
Excursionist
16 2 14

Yes I got it working by creating a new api permisssion app. But as the post from @Appifiny states you can just add `read_merchant_managed_fulfillment_orders` and/or `write_merchant_managed_fulfillment_orders` access scopes worked for me  (with read_assigned_fulfillment_orders and write_assigned_fulfillment_orders scopes).

FSG_Mark
Visitor
2 0 3

I still cannot get it to work.

 

When I access the following endpoint

https://{{api_key}}:{{api_password}}@{{store_name}}.myshopify.com/admin/api/{{api_version}}/orders/{{0rder_id}}/fulfillments.json I get an empty array. I do have the following access scopes

"write_merchant_managed_fulfillment_orders",
"read_merchant_managed_fulfillment_orders",
"read_assigned_fulfillment_orders"
"write_assigned_fulfillment_orders"
"write_third_party_fulfillment_orders"
"read_third_party_fulfillment_orders"

So I cannot get the fulfillment order id associated with the order. have I missed something?

Dan140
Shopify Partner
3 0 0

Did you ever resolve this?

docasar
Shopify Partner
10 0 1

Hi, please notice that I was having the same issue when making the call without realising that I was using an old no longer valid scope:

GET https://{SHOP}.myshopify.com/admin/api/2022-01/orders/{ORDER_ID}/fulfillments.json as per previous documentation, and I was getting empty array...

 

BUT (this make the trick for me) if we read above in @awwdam comment, the correct endpoint is .../fulfillment_orders.json, by using the suggested endpoint I got it working also.

 

Hope this help