Covers all questions related to inventory management, order fulfillment, and shipping.
Hi all,
When creating an order via the GraphQL API, there are the fields:
"shippingLine": { "price": "", "shippingRateHandle": "", "title": "" },
However, I can't see how I can retrieve the "shippingRateHandle" from the API in the first place. In fact, I can't see how you can retrieve any costs associated with any delivery profiles / shipping rates at all via the GraphQL API.
There is the ShippingZone REST API: https://shopify.dev/docs/api/admin-rest/2023-01/resources/shippingzone - however, this doesn't appear to return a field which maps back to the GraphQL "draftOrderCreate" "shippingLine > handle".
Can anyone shed any light on how shipping rates can be retrieved and then included as appropriate when creating an order?
Thanks very much 🙂
Hi Storedave,
The "shippingRateHandle" field in the DraftOrderCreateInput object for the GraphQL API is not something that can be directly retrieved from the API. The handle is a unique identifier for the shipping rate and is usually composed of the shipping method name and the shipping zone.
However, if you're creating a draft order, it's possible to specify your own value for the "price" and "title" fields, so if you know the shipping cost and the shipping method, you could directly specify those, and provide any string as the "handle", or even leave it out.
Hope this helps!
Liam | Developer Advocate @ 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