A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi Shopify Expert,
I created a fulfillment location service, and its callback never fires when user send a fulfillment request.
const fulfillmentService = { callback_url: "https://www.xyz.com/webhook/fulfillment_request", fulfillmentOrdersOptIn: true, inventoryManagement: true, name: "xyz ", permitsSkuSharing: true, trackingSupport: false, }; await new Promise((resolve, reject) => { shopifyClient .query({ data: { query: ` mutation fulfillmentServiceCreate($name: String!) { fulfillmentServiceCreate(name: $name) { fulfillmentService { location { id } } userErrors { field message } } } `, variables: fulfillmentService, }, })
[Still need help]Some debug process: I find that I mis-spell the 'callbackURL', However, after I put the correct URL, and read location service, the URL is still null, and optIn: false.
Hey @yinghechen have you tried defining the variables like this?
{
"name": "example_fulfillment_service",
"fulfillmentOrdersOptIn": true,
"callbackUrl": "https://callback.org/"
}
If you're using our Node.js library to set your app up, you'd also want to set up the initial mutation like this:
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation fulfillmentServiceCreate($name: String!, $callbackUrl: URL!, $fulfillmentOrdersOptIn: Boolean!) {
fulfillmentServiceCreate(name: $name, callbackUrl: $callbackUrl, fulfillmentOrdersOptIn: $fulfillmentOrdersOptIn) {
fulfillmentService {
id
serviceName
callbackUrl
fulfillmentOrdersOptIn
}
userErrors {
field
message
}
}
}`,
"variables": {
"name": "example_fulfillment_service",
"fulfillmentOrdersOptIn": true,
"callbackUrl": "https://callback.org/"
},
},
});
My understand is that you can't implement a defined JS object within the variables of the GraphQL call itself. Hope this helps!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog