draftOrderCreate() only recognizes custom shippingLine

mfio
Shopify Partner
3 0 0

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?

Replies 5 (5)

GrahamS
Shopify Staff (Retired)
193 36 53

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:

 

29-57-ce47n-vitdt

29-56-2yaqc-1964j

29-58-uzjik-8t4nw

29-00-zrky4-wqf1f

To learn more visit the Shopify Help Center or the Community Blog.

mfio
Shopify Partner
3 0 0

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?

InstaPunchout
Shopify Partner
4 0 2

I used to do it as the solution above suggested, but it  suddenly stopped working today, did you have any luck in resolving the issue?

bluepnume
Shopify Partner
9 0 4

Does your store have a "Carrier and app rates" set? We're seeing the same issue but only when we have a "Carrier and app rates" shipping option: https://community.shopify.com/c/shopify-apps/shopify-post-draft-order-not-respecting-passed-shipping...

InstaPunchout
Shopify Partner
4 0 2

Yes, we have "Carrier and app rates" set, but it was working before fine until 1 week ago when it stopped working for no reason, and it is causing us huge problem