Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I am trying to create draft order through graphql. I am passing item title and price (as integer) in request body but still getting error messages saying "Title can't be blank" and "Price is not a number". Here is my mutation:
mutation {
draftOrderCreate(input: {
note: "Test draft order",
email: "test.user@shopify.com",
taxExempt: true,
tags: "foo, bar",
shippingLine: {
title: "Custom Shipping",
price: 4
},
shippingAddress: {
address1: "123 Main St",
city: "Waterloo",
province: "Ontario",
country: "Canada",
zip: "A1A 1A1"
},
billingAddress: {
address1: "456 Main St",
city: "Toronto",
province: "Ontario",
country: "Canada",
zip: "Z9Z 9Z9"
},
lineItems: [
{
title: "Custom product",
originalUnitPrice: "14",
quantity: 5,
customAttributes: [
{
key: "color",
value: "Gold"
},
{
key: "material",
value: "Plastic"
}
]
},
{
sku: "qwerty",
quantity: 2
}
],
customAttributes: [
{
key: "name",
value: "Achilles"
},
{
key: "city",
value: "Troy"
}
]
})
{
userErrors {
field
message
}
draftOrder {
id
}
}
}
Response:
{
"data": {
"draftOrderCreate": {
"userErrors": [
{
"field": [
"lineItems",
"1",
"title"
],
"message": "Title can't be blank"
},
{
"field": [
"lineItems",
"1",
"originalUnitPrice"
],
"message": "Price is not a number"
}
],
"draftOrder": null
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
Can someone please help me finding what i am missing.