Get Shipping Zone By Using Draft Order Api

I am trying to get shipping zone from draft Order api
My Scenario ===>
I have build a upsell funnel in WordPress by using draft order api because we need to apply discount codes and also add upsell/down sell products to the order

In First Step user select product and also optional product [order bump ] and provide their shipping address and enter their card details
We create draft order and charge payment using stripe for those selected products
and then redirect them to the upsell page where we have another bundle products offer and they can add that to the order [If they add to their order then that automatically added to the draftorder line items] and make another charge for that bundle product through stripe and redirect them to the Order Confirmation page and completes the draftorder using api and shows them their order summary

[====ISSUE=====]
In that whole process above I am unable to select shipping zones based on the draftorder line items price and customer shipping address
As i have checked shipping_zone.json only getable through checkout token but in draftorder api i don’t have any checkout token please let me know if there is any way to get checkout token from draftorder

@Brett13 I have checked your anwser but invoice_url does not have that checkout token at the end

https://community.shopify.com/c/shopify-apis-and-sdks/calculate-shipping-rate-with-draft-order-api/m-p/830359/highlight/true#M53838

I have tried that solution but Invoice Url does not have checkout token

I am using Sale Channel app for creating draftorder

Hey @JeremyMcgilvrey - that is definitely an odd issue you’re seeing. I was able to use a simple GET request on my test store’s draft_orders.json endpoint through the Postman API client and was able to surface the invoice URL with the cart token (highlighted in red):

Would you be able to share an X-Request-Id from a response header to one of your calls where the invoice_url field didn’t surface the data correctly? I’d be happy to take a look at our logs and see what we’re able to find out.

Hope to hear form you soon - cheers!

1 Like

I am getting same invoice_url but I need checkout token to get shipping_rates.json

How i can get shipping_rates from draftorder ?

@Alan_19 Thank you for looking into this but I am unable to get shipping rates because i don’t have checkout token

shipping_rates.json only available for checkout token
I am getting same invoice_url but I need checkout token to get shipping_rates.json

How i can get shipping_rates from draftorder ?

Hey @JeremyMcgilvrey - thanks for your patience on this. I did a bit of testing on my own store to see if we could get the shipping rate to surface and it looks like if you were to just request a specific draft order through a GET request using a URL like this it should show the accurate shipping rate, name and pricing:
https://[your-store].myshopify.com/admin/api/2021-10/draft_orders/[draft-order-number].json

In the Postman API client, the line would look like this:

To access this, you’d only need the order ID for whichever Draft Order you’d like to access and you would also be able to update the order using some of the example requests here. Hope this helps - let us know if we can clarify anything further on our end.

Hi @JeremyMcgilvrey ,
Have you found the solution yet?

If not, then maybe the following can help you get the shipping rates:
https://community.shopify.com/c/shopify-apis-and-sdks/calculate-shipping-rate-with-draft-order-api/m-p/947056/highlight/true#M58646

The solution is using the GraphQL API instead of the REST API. GraphQL may seem complicated at first but it is fairly easy to use.