Create fulfillment order via graphql version 2022 10

hi to everyone

Here is my code in graphql

mutation {
fulfillmentCreateV2(
fulfillment: {
lineItemsByFulfillmentOrder:{
fulfillmentOrderId:“gid://shopify/FulfillmentOrder/5980523495657”
}
notifyCustomer:true
trackingInfo: {
number: “9400111108”,
company: "Test ",
}
}
) {
fulfillment {
id
}
}
}

and i got response 200 ok with this message

{
“data”: {
“fulfillmentCreateV2”: {
“fulfillment”: null
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 10,
“actualQueryCost”: 10,
“throttleStatus”: {
“maximumAvailable”: 1000.0,
“currentlyAvailable”: 990,
“restoreRate”: 50.0
}
}
}
}

But nothing happened to the order and the tracking number was not added

Hi Hmjeh,

You have probably used order id instead of fulfillment order id, it’s not the same. You can get your fulfillment order id for order 5980523495657 using this query:

query {
  order(id: "gid://shopify/Order/5980523495657") {
    fulfillmentOrders(first: 1) {
      nodes {
        id
      }
    }
  }
}

Then use fulfillment order id from result to your mutation.

1 Like

thanks

but

i try and i got the same result

I still have the problem

I want to expand and explain exactly what I do
that if someone sees something wrong that they correct me

query {
orders(first:40, query:“fulfillment_status:unfulfilled AND shippingAddress.country:United States”){
edges {
node {
id
tags
displayFulfillmentStatus
shippingAddress {
address1
city
country
firstName
lastName
phone
provinceCode
zip
}
lineItems(first: 7) {
nodes {
quantity
product {
id
}}}
fulfillmentOrders(first: 1) {
nodes {
id
lineItems(first: 1) {
nodes {
id

}}}}
}}}}

the respones is

{
“data”: {
“orders”: {
“edges”: [
{
“node”: {
“id”: “gid://shopify/Order/4911188672745”,
“tags”: ,
“displayFulfillmentStatus”: “UNFULFILLED”,
“shippingAddress”: {
“address1”: “xxxxxxxxx”,
“city”: “Fort Lauderdale”,
“country”: “United States”,
“firstName”: “xyz”,
“lastName”: “abc”,
“phone”: “(917) 123-45678”,
“provinceCode”: “FL”,
“zip”: “12345”
},
“lineItems”: {
“nodes”: [
{
“quantity”: 1,
“product”: {
“id”: “gid://shopify/Product/7923302924521”
}}]},
“fulfillmentOrders”: {
“nodes”: [
{
“id”: “gid://shopify/FulfillmentOrder/5980523495657”,
“lineItems”: {
“nodes”: [
{
“id”: “gid://shopify/FulfillmentOrderLineItem/12689390207209”
}]}}]}}},

and i want to create fulfillmet to this order via mutation

mutation {
fulfillmentCreateV2(
fulfillment: {
lineItemsByFulfillmentOrder:{
fulfillmentOrderId:“gid://shopify/FulfillmentOrder/5980523495657”
}
notifyCustomer:true
trackingInfo: {
number: “940011116666608”,
company: "Test ",

}}) {
fulfillment {
id
}}}

But unfortunately I can’t

Everything looks good, are you able to fulfill the whole order manually using button? Maybe you have something unconfigured in your store.

yes i can fulfilled manually

What could be not configured well ?

I gave me all permissions

I solved the problem.
It was caused because I fulfilled through the website manually
Then a fulfill number was created, then I did an unfulfilled for the same order
As a result, a new FULFILLMENT ORDER NUMBER was created for me
And in my query, I always take the first one that is no longer relevant

Now my question is, is there a way to make a QUERY and return it to the last fulfillment order?

I’m not sure I understand your question but you can query order and get Order.fulfillmentOrders field, is that something you are asking for?

no i ask for how to fulfill order no to query

but thank

i solve the problem