I’m trying to use draftOrderCreate to create an draftOrder that is “Pick up in store”.
For example, if I do this for my dev store the-misty-marketplace.myshopify.com
mutation {
draftOrderCreate(input: {
email: “{hidden}”
shippingAddress: {
address1: “123 Anytown Road”,
city: “New York”,
provinceCode: “NY”,
countryCode: US,
zip: “11211”
}
shippingLine:{
shippingRateHandle:“fa836c340f8c99d0761d97b9b87232aa”
}
lineItems: [
{
variantId: “gid://shopify/ProductVariant/44389836325072”,
quantity: 1,
}
]
}) {
draftOrder {
id
shippingLine {
carrierIdentifier
code
custom
deliveryCategory
shippingRateHandle
id
source
title
}
}
userErrors {
field
message
}
}
}
I successfully get a pickup order.
{
“data”: {
“draftOrderCreate”: {
“draftOrder”: {
“id”: “gid://shopify/DraftOrder/1175735173328”,
“shippingLine”: {
“carrierIdentifier”: null,
“code”: “YC House”,
“custom”: false,
“deliveryCategory”: “pick-up”,
“shippingRateHandle”: “fa836c340f8c99d0761d97b9b87232aa”,
“id”: “gid://shopify/ShippingLine/370998870224?type=draft_order”,
“source”: “shopify”,
“title”: “YC House”
}
},
“userErrors”:
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 11,
“actualQueryCost”: 11,
“throttleStatus”: {
“maximumAvailable”: 2000.0,
“currentlyAvailable”: 1989,
“restoreRate”: 100.0
}
}
}
}
But how do I get the shippingRateHandle if I don’t know already know it?
Calling draftOrderCalculate like so:
mutation {
draftOrderCalculate(input: {
email: “{hidden}”
shippingAddress: {
address1: “123 Anytown Road”,
city: “New York”,
provinceCode: “NY”,
countryCode: US,
zip: “11211”
}
lineItems: [
{
variantId: “gid://shopify/ProductVariant/44389836325072”,
quantity: 1,
}
]
}) {
calculatedDraftOrder {
alerts {
content
}
warnings {
message
}
availableShippingRates {
handle
title
}
}
userErrors {
field
message
}
}
}
Does not include any rates for “Pick up in store”, just shipping.
You’ll notice “fa836c340f8c99d0761d97b9b87232aa” is not included in availableShippingRates, even though otherwise taking the same input as draftOrderCreate above, so it should be included.
{
“data”: {
“draftOrderCalculate”: {
“calculatedDraftOrder”: {
“alerts”: ,
“warnings”: ,
“availableShippingRates”: [
{
“handle”: “7705a2ea0c5efd1128ea4819f74d6808”,
“title”: “Economy”
},
{
“handle”: “6d5a64f58240381019fc074473bab3ab”,
“title”: “Standard”
}
]
},
“userErrors”:
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 13,
“actualQueryCost”: 13,
“throttleStatus”: {
“maximumAvailable”: 2000.0,
“currentlyAvailable”: 1987,
“restoreRate”: 100.0
}
}
}
}
a) Is that intended, or a bug in the API?
b) If that’s intended, is there another way to get available shipping rates that include shipping rates that have “deliveryCategory”: “pick-up”?
c) If not, is there another way to programmatically create an order for pickup?