Development discussions around Shopify APIs
To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more
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 |
---|---|
6 | |
5 | |
5 | |
5 | |
4 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022