Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

GraphQL Orders Query updatedAt field updates inconsistently for Fulfillment Holds

GraphQL Orders Query updatedAt field updates inconsistently for Fulfillment Holds

wesista
Shopify Partner
6 1 4

Hi all,

 

I've built a fulfillment app for our store (carrier integrations in NZ are terrible, so it made sense for our use case to build).  We're adding in functionality to handle fulfillment holds, as they're quite useful if there are any issues with the customer's details.  However, the GraphQL API appears to be inconsistent in updating the updatedAt field if a fulfillment hold is applied or removed.  Our update is currently based on polling for new orders rather than using webhooks, and so we use a query to check for orders updated since our last poll.  If the updatedAt field doesn't change for a fulfillment hold, we can't update the order in our system.  

 

Our query is (just limited to one order for an example):

 

{
    orders (first: 10, query: "name:1024") {
        pageInfo {
            hasNextPage

        }
        edges{
          cursor
          node {
              name
              updatedAt
              createdAt
              fulfillmentOrders(first: 3, reverse: true) {
                  edges {
                      node {
                          id
                          status
                          deliveryMethod {
                              methodType
                          }
                      }
                  }
              }

          }
        }
    }
}

 

On an order with no fulfillment holds, this will return:

 

  "data": {
    "orders": {
      "pageInfo": {
        "hasNextPage": false
      },
      "edges": [
        {
          "cursor": "eyJsYXN0X2lkIjo0MjM2NDAwODUzMTg2LCJsYXN0X3ZhbHVlIjoxNjM2OTQ4MTUxMDAwfQ==",
          "node": {
            "name": "#1024",
            "updatedAt": "2021-11-23T04:08:43Z",
            "createdAt": "2021-11-15T03:49:11Z",
            "fulfillmentOrders": {
              "edges": [
                {
                  "node": {
                    "id": "gid://shopify/FulfillmentOrder/5139950731458",
                    "status": "OPEN",
                    "deliveryMethod": null
                  }
                }
              ]
            }
          }
        }
      ]
    }
  },

 

If I add a fulfillment hold, the query will return:

 

"data": {
    "orders": {
      "pageInfo": {
        "hasNextPage": false
      },
      "edges": [
        {
          "cursor": "eyJsYXN0X2lkIjo0MjM2NDAwODUzMTg2LCJsYXN0X3ZhbHVlIjoxNjM2OTQ4MTUxMDAwfQ==",
          "node": {
            "name": "#1024",
            "updatedAt": "2021-11-23T04:08:43Z",
            "createdAt": "2021-11-15T03:49:11Z",
            "fulfillmentOrders": {
              "edges": [
                {
                  "node": {
                    "id": "gid://shopify/FulfillmentOrder/5139950731458",
                    "status": "ON_HOLD",
                    "deliveryMethod": null
                  }
                }
              ]
            }
          }
        }
      ]
    }
  },

 

(note no change to the 'updatedAt' field)

 

When I remove the fulfillment hold ("Release Fulfillment" in the Shopify Admin), the query will return:

 

"data": {
    "orders": {
      "pageInfo": {
        "hasNextPage": false
      },
      "edges": [
        {
          "cursor": "eyJsYXN0X2lkIjo0MjM2NDAwODUzMTg2LCJsYXN0X3ZhbHVlIjoxNjM2OTQ4MTUxMDAwfQ==",
          "node": {
            "name": "#1024",
            "updatedAt": "2021-11-23T04:27:08Z",
            "createdAt": "2021-11-15T03:49:11Z",
            "fulfillmentOrders": {
              "edges": [
                {
                  "node": {
                    "id": "gid://shopify/FulfillmentOrder/5139950731458",
                    "status": "OPEN",
                    "deliveryMethod": null
                  }
                }
              ]
            }
          }
        }
      ]
    }
  },

 

which has the updatedAt field changed to reflect the update in the FulfillmentOrder status.

 

Is this intentional behaviour? Has anyone found a workaround around this?

Reply 1 (1)

DSokolowski
Shopify Partner
10 0 4

I am facing it too. It looks like putting order on hold does not update field :updated_at while releasing fulfillment does. This makes our system unable to fetch and handle an order once it got put on hold.