create fulfillment order via graphql version 2022 10

Solved

create fulfillment order via graphql version 2022 10

hmjeh
Tourist
11 3 0

 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
 
Accepted Solutions (2)
hmjeh
Tourist
11 3 0

This is an accepted solution.

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?

View solution in original post

hmjeh
Tourist
11 3 0

This is an accepted solution.

no i ask for how to fulfill order no to query

but thank

i solve the problem 

View solution in original post

Replies 8 (8)

Greg_P
Shopify Partner
41 4 35

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.

Shopify Developer
If I have solved your issue, please mark my post as accepted solution 🙂
hmjeh
Tourist
11 3 0

thanks

but

i try and i got the same result 

I still have the problem

hmjeh
Tourist
11 3 0

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

 

unfulfilld.PNG

Greg_P
Shopify Partner
41 4 35

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

Shopify Developer
If I have solved your issue, please mark my post as accepted solution 🙂
hmjeh
Tourist
11 3 0

yes i can fulfilled manually  

What could be not configured well ?
I gave me all permissions
hmjeh
Tourist
11 3 0

This is an accepted solution.

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?

Greg_P
Shopify Partner
41 4 35

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?

Shopify Developer
If I have solved your issue, please mark my post as accepted solution 🙂
hmjeh
Tourist
11 3 0

This is an accepted solution.

no i ask for how to fulfill order no to query

but thank

i solve the problem