Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hello,
I have been using Shopify's REST API for a while but it's beginning to outlive it's usefulness as we scale, I recently tried to switch to the Graph QL API as adviced but I am unable to create shipping lines which I was able to do via the REST API.
My draftordercreate input looks like this
{ "input": { "email": "...", "shippingAddress": {.... }, "billingAddress": {...}, "tags": "...", "shippingLine": [ { "price": "10.50", "shippingRateHandle": "Hingeto", "title": "Shipping" } ], "customAttributes": [ { "key": "Retailer Name", "value": "..." } ], "lineItems": [ { "variantId": "gid://shopify/ProductVariant/xxxxxxx", "quantity": 1, "appliedDiscount": { "amount": 0, "value": 0, "valueType": "FIXED_AMOUNT" } }, { "variantId": "gid://shopify/ProductVariant/xxxxxx", "quantity": 1, "appliedDiscount": { "amount": 0, "value": 0, "valueType": "FIXED_AMOUNT" } } ] } }
This successfully creates a draft order but when I view the order the shipping_lines is an empty array. I should also point out that it was SHippingLines [] for Rest but ShippingLine {} for GrapghQL
Hey @snameofficial ,
Is the shipping rate that you're passing in one that is available on your shop, or a custom rate?
If it's a custom rate, try to pass a shippingRateHandle that is a blank string instead (or just no shippingRateHandle field at all) and see if the shippingLine appears on your new draft. Even if it isn't a custom rate that you're passing in, I would suggest giving this a try as it would then indicate that it's probably the handle causing problems.
Josh | 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 the Shopify Help Center or the Shopify Blog
I ran into the same issue today. Using the shippingRateHandle causes the draft order to be created with the custom shipping line missing. Removing shippingRateHandle allows the draft order to be created correctly with the custom shipping line intact.
User | RANK |
---|---|
6 | |
5 | |
5 | |
4 | |
4 |