Development discussions around Shopify APIs
I was having issues getting the GraphQL API to recognize the shippingLine I was passing in. I found this thread that mentions omitting the shippingRateHandle. That works, but then it always creates a custom shippingLine:
"shippingLine": {
"id": "gid:\/\/shopify\/ShippingLine\/347937505456?type=draft_order",
"title": "Economy",
"code": "custom",
"shippingRateHandle": null,
"originalPriceSet": {
"presentmentMoney": {
"amount": "4.9",
"currencyCode": "USD"
}
}
}
How do I go about creating a non-custom shippingLine? I inspected the Network Tab while creating a draft order in Shopify's own admin interface at x.myshopify.com/admin/ - there it clearly requests the shippingLine with a specific shippingRateHandle and in the response it is evident that the shippingLine is not custom. I took the GraphQL payload from there and used it exactly with my own credentials, with no luck. Just to be sure I checked the permissions for my private app and added anything that sounded order-related.
What am I doing wrong?
Hey @mfio ,
Have you tried using draftOrderCalculate to generate the content for availableShippingRates and then copying out that info for your draftOrderCreate shipping input? I ran a test using this method and was able to successfully utilize a non-custom shipping line:
Graham S | API 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
Thank you for the response @GrahamS.
That is exactly what I tried to do. If I do it like you have shown, what I get back is:
"shippingLine": null
In order to make it work I omit the handle in the input, but what I get back is a custom shipping line:
"shippingLine": {
"title": "Economy International",
"code": "custom",
"shippingRateHandle": null,
"originalPriceSet": {
"presentmentMoney": {
"amount": "12.0",
"currencyCode": "USD"
}
}
}
I'm guessing there is something else in my request that triggers this. I would probably have to provide you with a minimal example, but it's hard to anonymize everything. Is there somewhere I can post you the info in private?
User | RANK |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023