FROM CACHE - en_header

Sales Channel: Unable to read orders from my sales channel that were created via Draft Order API

jql194
Tourist
15 0 3

When querying the Shopify Admin API via GraphQL, I'm unable to read order details for an order that was created by my sales channel via the Draft Orders API.

e.g. on the order page in.a ,merchant's admin, it shows "January 26, 2021 at 3:32 pm from My Sales Channel" (via import)

Even though I can see the order was attributed to my sales channel, the GraphQL query returns null. 

Is this a bug in Shopify's implementation? Shouldn't I be able to read this type of order? 

It works on my dev app/store which doesn't have the read_only_own_orders permission applied

 

Replies 4 (4)
jql194
Tourist
15 0 3

Repro steps

1. Create a draft order using a sales channel and the Draft Orders API. Get the url for the draft order.

2. Provide customer with the draft order url

3. Customer places order.

4. Observe Shopify Admin shows the Order as created and attributed to the sales channel

5. Get order id from a draft orders update webhook.

6. Try and query for order details using that order id via GraphQL API and that it returns null (unexpected -- it should return the data)

 

{

order(id: $id) {
  id
    <....any other fields>
  }
}
_JCC_
Shopify Staff
Shopify Staff
183 26 40

@jql194 ,

Despite the draft order being created by your sales channel, the actual completion of the draft order in this instance is done by a different channel.

The message sales channel (via import) is sourced from the draft order which confuses things. For the sales channel app to have access to the draft order, the sales channel app would have to complete the draft. In this instance using the GraphQL API, a mutation call to draftOrderComplete would result in an order with the sales channel linked to the app that made the draftOrderComplete call.

Hope this help provide some clarity. If you have any other questions let me know.

Regards,

John

John C | Developer 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

jql194
Tourist
15 0 3

Ahh ok that makes sense.

So it sounds like for my sales channel to be able to read an order, it must have been completed end to end in the sales channel. Is there any chance this restriction may be relaxed in the future? Or are there any exceptions for allowing reading of orders created in the flow of: sales channel generates draft order, user places order using online store?

_JCC_
Shopify Staff
Shopify Staff
183 26 40

Yes you got it, for your channel to be attributed on the order your channel has to complete the draft. I've actually had a similar ask earlier this week and I've shared this and your feedback with our orders team. I will try and follow-up if something changes on this front.

Regards,

John

John C | Developer 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