draftOrderCreate - ShippingLineInput not working

Topic summary

A developer encountered an issue where draftOrderCreate GraphQL API was applying default shipping costs despite attempting to set shipping to $0 using ShippingLineInput.

Problem Details:

  • When providing both shippingRateHandle and price: 0.0 in the shipping line input, the API ignored the custom price and applied the carrier rate associated with the handle ($42 ‘International Shipping’).
  • The developer wanted to create zero-cost orders (zero subtotal, taxes, and shipping).

Solution Found:

  • Removing shippingRateHandle from the input and providing only price (as float) and title (as string) successfully created a custom shipping line with $0 cost.

Official Clarification:

  • Shopify support confirmed this is expected behavior:
    • Including shippingRateHandle pulls the rate from shipping settings (ignoring custom price/title)
    • Excluding the handle allows custom rates using the provided price and title
  • The REST API documentation explains this more clearly than GraphQL docs
  • Feedback was passed to the documentation team to improve clarity on these fields

Status: Resolved through workaround; documentation improvement requested.

Summarized with AI on November 16. AI used: claude-sonnet-4-5-20250929.

Hi,

I am trying to use the draftOrderCreate GraphQL API to create a zero cost order (i.e., zero subtotal, zero taxes, and zero shipping). But, despite my effort to set the shippingLine input to $0, the draft orders are getting created with default positive shipping costs.

Here is the DraftOrderInput I passed to the API:
{‘billingAddress’: {‘address1’: ‘1 Ted Rogers Way’, ‘address2’: None, ‘city’: ‘Toronto’, ‘company’: None, ‘country’: ‘Canada’, ‘countryCode’: ‘CA’, ‘firstName’: None, ‘id’: None, ‘lastName’: None, ‘phone’: ‘256-316-0966’, ‘province’: ‘Ontario’, ‘provinceCode’: ‘ON’, ‘zip’: ‘M4Y 3B7’}, ‘email’: ‘jake123@gmail.com’, ‘lineItems’: [{‘quantity’: 1, ‘variantId’: ‘gid://shopify/ProductVariant/45357904986401’}], ‘note’: ‘Exchange for Order #1063’, ‘phone’: ‘256-316-0966’, ‘presentmentCurrencyCode’: ‘CAD’, ‘purchasingEntity’: {‘customerId’: ‘gid://shopify/Customer/7139793731873’}, ‘reserveInventoryUntil’: ‘2023-10-11T12:49:27.835601-04:00’, ‘shippingAddress’: {‘address1’: ‘1 Ted Rogers Way’, ‘address2’: None, ‘city’: ‘Toronto’, ‘company’: None, ‘country’: ‘Canada’, ‘countryCode’: ‘CA’, ‘firstName’: None, ‘id’: None, ‘lastName’: None, ‘phone’: ‘256-316-0966’, ‘province’: ‘Ontario’, ‘provinceCode’: ‘ON’, ‘zip’: ‘M4Y 3B7’}, ‘shippingLine’: {‘price’: ‘0.0’, ‘shippingRateHandle’: ‘free-shipping’, ‘title’: ‘Free Shipping’}, ‘tags’: [‘’], ‘useCustomerDefaultAddress’: True, ‘visibleToCustomer’: True, ‘appliedDiscount’: {‘description’: ‘Items in an exchange order are not charged.’, ‘title’: ‘Zero-cost order’, ‘value’: 100.0, ‘valueType’: ‘PERCENTAGE’}}

And here’s the response (notice the shippingLine as ‘International Shipping’ with $42):

{‘data’: {‘draftOrderCreate’: {‘draftOrder’: {‘id’: ‘gid://shopify/DraftOrder/1129791127841’, ‘name’: ‘#D126’, ‘shippingLine’: {‘code’: ‘International Shipping’, ‘custom’: False, ‘deliveryCategory’: ‘shipping’, ‘originalPriceSet’: {‘presentmentMoney’: {‘amount’: ‘42.0’, ‘currencyCode’: ‘CAD’}}, ‘shippingRateHandle’: ‘5a141a6edf7ffccc57390a16d58bf042’, ‘source’: ‘shopify’, ‘title’: ‘International Shipping’}}, ‘userErrors’: }}, ‘extensions’: {‘cost’: {‘requestedQueryCost’: 12, ‘actualQueryCost’: 12, ‘throttleStatus’: {‘maximumAvailable’: 1000.0, ‘currentlyAvailable’: 988, ‘restoreRate’: 50.0}}}}

Thanks,
Frate Team

I think I just solved my problem: by removing shippingRateHandle from the shipping line input, and only providing the price (as a float) and title (as a string).

This is a weird bug that shopify could perhaps fix, no?

1 Like

Hey @jake-frate ! Thanks for sharing that and that you’ve found a resolution.

The behaviour you’re seeing is expected. When you include the shippingRateHandle, this will provide the shipping rate from your shipping settings, and when it’s excluded it will use the price and title for a custom rate.

Our REST documentation explains this behaviour a bit better:

About custom shipping lines> > You can use the DraftOrder resource to send orders with custom shipping lines. A custom shipping line includes a title and price with handle set to Nil. A shipping line with a carrier provided shipping rate (currently set via the Shopify admin) includes the shipping rate handle.

I have passed on feedback to our documentation team to make our documentation more clear on what to expect for these fields.

Hope that helps!

  • Kyle G.