//native
/**
* Get Fulfillment Order
* Get a fulfillment order by numeric ID or GID: status, assigned location, destination, holds, supported actions, line items and the fulfillments created from it.
*/
export async function main(auth: RT.Shopify, fulfillment_order_id: string) {
const response = await fetch(
`https://${auth.store_name}.myshopify.com/admin/api/2026-10/graphql.json`,
{
method: "POST",
headers: {
"X-Shopify-Access-Token": auth.token,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
query: `query ($id: ID!) { fulfillmentOrder(id: $id) { id status requestStatus orderId orderName orderProcessedAt createdAt updatedAt fulfillAt fulfillBy assignedLocation { name address1 city countryCode location { id } } destination { firstName lastName company address1 address2 city province zip countryCode email phone } deliveryMethod { methodType } fulfillmentHolds { id reason reasonNotes handle displayReason } supportedActions { action } lineItems(first: 250) { nodes { id sku productTitle variantTitle totalQuantity remainingQuantity requiresShipping lineItem { id } variant { id } } } fulfillments(first: 20) { nodes { id name status createdAt } } } }`,
variables: {
id: fulfillment_order_id.startsWith("gid://")
? fulfillment_order_id
: `gid://shopify/FulfillmentOrder/${fulfillment_order_id}`,
},
}),
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
const { data, errors } = await response.json()
if (errors) {
throw new Error(JSON.stringify(errors))
}
if (!data.fulfillmentOrder) {
throw new Error(`Fulfillment order ${fulfillment_order_id} not found`)
}
return data.fulfillmentOrder
}
Submitted by hugo989 3 hours ago