Cannot mark an imported order as fulfilled with GraphQL

Cannot mark an imported order as fulfilled with GraphQL

tarponjargon
Shopify Partner
2 0 0

I am importing orders from our legacy e-commerce platform to shopify using graphql.  I am import the orders just fine, but they show as "Unfulfilled" in shopify.  I need them to show as "Fulfilled" as they are historical orders.

 

According to the FulfillmentOrder docs: "Shopify creates fulfillment orders automatically when an order is created." and that I need to query the FulfillmentOrder with the order ID to get the Fulfillment Order, then once I have that, do a FulfillmentCreate mutation to mark the order as fulfilled.

 

The problem is, when I try to get the Fulfillment Order with the order id, no result is returned, so I can't create the fulfillment.  At first I was getting access scope errors, but I fixed those.  When I run the fulfillmentOrders query for an order that DEFINITELY exists:

 

query GetFulfillmentOrdersForOrder {
  order(id: "gid://shopify/Order/6670350909773") {
    fulfillmentOrders(first: 10) {
      nodes {
        id
        status
        createdAt
        fulfillAt
        destination {
          address1
          city
          province
          zip
        }
        lineItems(first: 5) {
          nodes {
            id
            totalQuantity
            variant {
              id
              title
            }
          }
        }
        assignedLocation {
          name
          address1
          city
          province
          zip
        }
      }
    }
  }
}

 I get a response, but the fulfillmentOrders array is empty

{
    "data": {
        "order": {
            "fulfillmentOrders": {
                "nodes": []
            }
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 47,
            "actualQueryCost": 3,
            "throttleStatus": {
                "maximumAvailable": 2000.0,
                "currentlyAvailable": 1997,
                "restoreRate": 100.0
            }
        }
    }
}

 

What am I missing?

 

If it is relevant, inventory tracking is not on for the products in our shop as most of them are drop shipped.

Reply 1 (1)

Olamihwebszpert
New Member
11 0 0

Hi there! It sounds like you’ve made good progress with importing historical orders, but the missing fulfillment orders can definitely be confusing. One thing to consider is that Shopify doesn’t always generate fulfillment orders automatically for imported or historical orders, especially if inventory tracking is turned off or if the fulfillment service isn’t assigned. You might want to double-check whether the imported orders have fulfillment locations or services properly set, because without that, the fulfillmentOrders query might return empty. Also, some users find they need to trigger fulfillment creation differently when dealing with older data, such as using the legacy fulfillment API or switching to REST just for that part. If you haven’t already, reviewing the order object’s fulfillment status and checking if fulfillable items are assigned could help point to what’s missing.