Getting items on fulfillmentOrders

Hi,

We have an issue we cannot figure out. Using GraphQL 2023-01. Now the lineItem on fulfillmentOrder.fulfillmentOrderLineItem has been deprecated.

So how can we get the variant id when it’s not there anymore, to match it to the corresponding variant on the order?

We are using this to handle Shopify locations.

Test query:

{
  order(id: "gid://shopify/Order/4562942885934") {
    fulfillmentOrders(first: 3, reverse:true) {
      edges {
        node {
          id
          status
          requestStatus
          lineItems(first: 3) {
            edges {
              node {
                id
                sku
                productTitle
                variantTitle
                remainingQuantity
                totalQuantity
              }
            }
          }
          fulfillments(first: 5) {
            nodes {
              name
              status
              fulfillmentOrders(first: 2) {
                nodes {
                  assignedLocation {
                    location {id}
                  }
                }
              }
              fulfillmentLineItems(first: 2) {
                edges {
                  node {
                    quantity
                    lineItem {
                      title
                    }
                  }
                }
              }
            }
          }
          requestStatus
          fulfillAt
          fulfillBy
          fulfillmentHolds {
            reason
            reasonNotes
          }
          assignedLocation {
            location {
              id
              name
            }
          }
        }
      }
    }
  }
}

The response:

{
  "data": {
    "order": {
      "fulfillmentOrders": {
        "edges": [
          {
            "node": {
              "id": "gid://shopify/FulfillmentOrder/5575719321646",
              "status": "OPEN",
              "requestStatus": "UNSUBMITTED",
              "lineItems": {
                "edges": [
                  {
                    "node": {
                      "id": "gid://shopify/FulfillmentOrderLineItem/11599907389486",
                      "sku": "545461My",
                      "productTitle": "12V charger plug Mylocation",
                      "variantTitle": "White",
                      "remainingQuantity": 5,
                      "totalQuantity": 5
                    }
                  }
                ]
              },
              "fulfillments": {
                "nodes": []
              },
              "fulfillAt": "2023-01-21T08:00:00Z",
              "fulfillBy": null,
              "fulfillmentHolds": [],
              "assignedLocation": {
                "location": {
                  "id": "gid://shopify/Location/35634839598",
                  "name": "My location"
                }
              }
            }
          },
          {
            "node": {
              "id": "gid://shopify/FulfillmentOrder/5575719288878",
              "status": "OPEN",
              "requestStatus": "UNSUBMITTED",
              "lineItems": {
                "edges": [
                  {
                    "node": {
                      "id": "gid://shopify/FulfillmentOrderLineItem/11599907356718",
                      "sku": "545461T2",
                      "productTitle": "12V charger plug tmplocation",
                      "variantTitle": "White",
                      "remainingQuantity": 4,
                      "totalQuantity": 4
                    }
                  }
                ]
              },
              "fulfillments": {
                "nodes": []
              },
              "fulfillAt": "2023-01-21T08:00:00Z",
              "fulfillBy": null,
              "fulfillmentHolds": [],
              "assignedLocation": {
                "location": {
                  "id": "gid://shopify/Location/60959162414",
                  "name": "TmpLocation"
                }
              }
            }
          }
        ]
      }
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 261,
      "actualQueryCost": 23,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 977,
        "restoreRate": 50
      }
    }
  }
}

So we get the two fulfillmentOrders (one for each location), but we have no clue which distinct variants is on each fulfillmentOrder to match it to the variants on the order. It returns sku and productTitle, not none of these are unique, and sku can also be blank.

Hi @DavidDB1

The 2023-01 version of the API’s fulfillmentOrderLineItem still has variant title and SKU field that could be used as productVariantConnection arguments.

There’s also an inventoryItemId field scheduled to be released in the 2023-04 version.

Hope that helps.

1 Like

At what point did Shopify decide to move away from the gid and use SKU and title?

None of these are truly unique (even combined), and then there is no guarantee that it will match the right product, and many of our clients does not use SKU at all. A total recipe for disaster.

In the REST API, it returns the unique id of the product.

Regarding inventoryItemId this will mean that we have read this on the order also (to match), adding to the query cost that we’re already struggling big with. And anyway this will not be available until April in production.

If Shopify wants apps to start using fulfillmentOrder this is the totally wrong path to follow.

2 Likes

Shopify provided an update in https://community.shopify.com/c/fulfillment-api-deprecation/major-issue-with-fulfillmentorder/m-p/1922104/thread-id/147/highlight/true

1 Like