Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Not enough order details in Fulfillment Order API

Solved

Not enough order details in Fulfillment Order API

Colin_M
Shopify Partner
16 1 7

As an API consumer that represents a WMS which provides a fulfillment service there are not enough details exposed on the FulfillmentOrder API to be able to fulfill the order without also using the Order API to get additional order details. This poses a few issues:

- We must require scopes that would otherwise not be required (`read_orders`)

- We must require `read_all_orders` scope to fulfill orders that are 61+ days old (should really only consider orders "old" after they are completed)

 

For example, just adding these fields would make it unnecessary to use the Order API:

- shipping_lines (code, source, title)

note_attributes

- tags

 

Similarly and in addition, it would be great to be able to add/remove `note_attributes` and `tags` without reading an order. Perhaps these actions should have separate API methods/mutations. Otherwise, to add a tag or note attribute you must first read the order to avoid clobbering other notes/tags that are unrelated to your app. This again requires `read_all_orders` for old orders and `read_orders` when it would otherwise be unnecessary.

 

Thanks!

Accepted Solution (1)

garyrgilbert
Shopify Partner
431 41 185

This is an accepted solution.

yep, the 60 day thing is a PITA for uncompleted (unpaid/unfulfilled) orders.

 

Since you are a fulfillment service did you create your app as a fulfillment service app or an order management app? If you created it as a fulfillment service app you will already be notified when there is a fulfillment order that was assigned to your location (via the webhooks). In that case you have the fulfillment order id and are using that to query the fulfillmentOrder REST api right?

 

However, You do have other options available instead of using the REST API where the information available is severly limited, you could for example, use the graphql fulfillmentOrder resource and get only the information you are interested in, or only the information you are still missing without having to do a query directly to the order resource.

 

I believe if you have the right access scope you will not need read_orders or read_all_orders access scope because the read/write fullfillment orders access scopes have access to the order information inherently. In fact I just tested it on a dev app which does not have read all orders and I was able to query the shippinglines, notes and tags on an order from January.

 

{
	fulfillmentOrder(id:"gid://shopify/FulfillmentOrder/6301844078807"){
    order{
      shippingLine{
        code
      }
      note
      tags
    }
  }
}

 

Cheers,

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

View solution in original post

Replies 5 (5)

garyrgilbert
Shopify Partner
431 41 185

This is an accepted solution.

yep, the 60 day thing is a PITA for uncompleted (unpaid/unfulfilled) orders.

 

Since you are a fulfillment service did you create your app as a fulfillment service app or an order management app? If you created it as a fulfillment service app you will already be notified when there is a fulfillment order that was assigned to your location (via the webhooks). In that case you have the fulfillment order id and are using that to query the fulfillmentOrder REST api right?

 

However, You do have other options available instead of using the REST API where the information available is severly limited, you could for example, use the graphql fulfillmentOrder resource and get only the information you are interested in, or only the information you are still missing without having to do a query directly to the order resource.

 

I believe if you have the right access scope you will not need read_orders or read_all_orders access scope because the read/write fullfillment orders access scopes have access to the order information inherently. In fact I just tested it on a dev app which does not have read all orders and I was able to query the shippinglines, notes and tags on an order from January.

 

{
	fulfillmentOrder(id:"gid://shopify/FulfillmentOrder/6301844078807"){
    order{
      shippingLine{
        code
      }
      note
      tags
    }
  }
}

 

Cheers,

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Colin_M
Shopify Partner
16 1 7

Brilliant, Gary! We'll try using the GraphQL as you stated when updating note and tags. Thanks!

 

However, there is still the issue of not being able to read orders that are not complete yet. If fulfillment was not requested until the order was over 60 days old we would have never had an opportunity to read the order details needed to complete fulfillment so allowing fulfillment service API consumers to read orders that are not complete regardless of age is the only sensible fix - I'd love to get some feedback from Shopify staff on this so leaving this open.

garyrgilbert
Shopify Partner
431 41 185

Hi Colin,

 

Not sure I understand what you mean about not being able to read the order details.

 

From a fulfillmentOrder you should have just about everything you need to execute the fulfillment (with the exception of the orderline, tags and notes fields). Destination address, line items to fulfill, quantity etc.

 

You also have access to the entire order from within the fulfillmentOrder graphql resource thereby not requiring the read_orders/read_all_orders access scope.  I just only selected the shippingline, tags and notes columns from the order. I do agree though that the REST API information is limited without doing additional queries, but with using graphql you have way more granual control.

 

What other information are you missing in order to be able to fulifll the order?

 

Good luck and maybe @ShopifyDevSup could see about getting you feedback to that. 

 

Cheers,

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Colin_M
Shopify Partner
16 1 7

Ahh, you are correct, sorry - I forgot that the full destination was included on the FO response already. Thanks again!

 

Still, Shopify should change the way they define the age of an order to be after it is complete, in my opinion. 🙂

garyrgilbert
Shopify Partner
431 41 185

agreed

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution