Draft order takes time to complete

ShiraBoa
Excursionist
13 0 4

Hi,

 

When I complete a draft order through API, sometimes although the action succeeds, it takes time, and completes after I receive a response. Does that make sense? Is there a way for me to tell when the action is completed?

 

Thanks,

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 182

Hey @ShiraBoa,

 

I actually answered a similar question earlier today on a different post. Please see this post and don't hesitate to reach out if there are any questions/

 

https://community.shopify.com/c/Shopify-APIs-SDKs/Draft-API-Error-URL-not-ready/td-p/574400

JB | 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

0 Likes
ShiraBoa
Excursionist
13 0 4

Hi @_JB ,

 

I was asking about completing a draft order. As I understood from Shopify documentation, when a draft order is created / updated the taxes are calculated and that might take time, and therefore the 202 response is returned.

In my case I'm only completing an already existing draft order, so no calculations are needed (as I understand), and it still takes time.

Do you know if a 202 code response may return in a completion of a draft order although not mentioned in the documentation (or maybe mentioned but I missed it)?

 

Thanks,

Shira

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 182

Hey @ShiraBoa,

 

Yes the same is true when completing a draft. Even if the draft already exists, any calculations will happen again when you complete the order, so a 202 response is still possible and should be handled as described in the other post.

JB | 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

ShiraBoa
Excursionist
13 0 4

Thanks a lot!

amosmos
Shopify Expert
52 1 12

Hey @_JB ,

 

It is me from the other post :-) And Shira and I actually work together :-)

 

So I have several questions:

1) Why is it that Shopify re-calculate the taxes when completing an order?

2) If that's the case, then it could be that the taxes will turn out to be different than what they were when the draft was created, and such a case is breaking the practice of using the draft api to calculate the taxes before charging the customer, no?

3) In the documentation, the polling note only appears in the draft order creation part, I think it's best to put it somewhere on the top as it seems to be relevant to more actions.

ShiraBoa
Excursionist
13 0 4
Hi again,

Would it be correct to do, similar to the post your referred me to, instead
of using the 'location' provided in the response, since I'm using API to
PUT:
../admin/api/2020-04/draft_orders/'.$complete_draft_response->body->
draft_order->id.'/complete.json'

Thanks again,

0 Likes
ShiraBoa
Excursionist
13 0 4
Hi again,
 
Would it be correct to do, similarly to the post your referred me to, instead of using the 'location' provided in the response, since I'm using API to PUT:
../admin/api/2020-04/draft_orders/'.$complete_draft_response->body->draft_order->id.'/complete.json' 
 
Thanks,
0 Likes
ShiraBoa
Excursionist
13 0 4

@_JB can you please help here :) ?

0 Likes