How to Fix 'Invalid fulfillment_order_id provided' Error in Shopify's ready for pickup Mutation?

I am trying set a fulfillment order as ready for pickup but I am getting an error “Invalid fulfillment_order_id provided”

Here is the fulfillment order

{
  "code": 200,
  "result": {
    "data": {
      "fulfillmentOrder": {
        "id": "gid://shopify/FulfillmentOrder/7591739588788",
        "status": "OPEN",
        "lineItems": {
          "nodes": [
            {
              "id": "gid://shopify/FulfillmentOrderLineItem/15460822843572",
              "totalQuantity": 1
            },
            {
              "id": "gid://shopify/FulfillmentOrderLineItem/15460822876340",
              "totalQuantity": 1
            }
          ]
        }
      }
    },
    "extensions": {
      "cost": {
        "requestedQueryCost": 7,
        "actualQueryCost": 4,
        "throttleStatus": {
          "maximumAvailable": 2000,
          "currentlyAvailable": 1996,
          "restoreRate": 100
        }
      }
    }
  }
}

This is my query

mutation fulfillmentOrderLineItemsPreparedForPickup($input: FulfillmentOrderLineItemsPreparedForPickupInput!) {
  fulfillmentOrderLineItemsPreparedForPickup(input: $input) {
    userErrors {
      field
      message
    }
  }
}

{
  "input": {
    "lineItemsByFulfillmentOrder": [
      {
        "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/7591739588788"
      }
    ]
  }
}

This is the error I am getting

{
  "code": 200,
  "result": {
    "data": {
      "fulfillmentOrderLineItemsPreparedForPickup": {
        "userErrors": [
          {
            "field": [
              "input",
              "lineItemsByFulfillmentOrder",
              "0",
              "fulfillmentOrderId"
            ],
            "message": "Invalid fulfillment_order_id provided 7591739588788"
          }
        ]
      }
    },
    "extensions": {
      "cost": {
        "requestedQueryCost": 10,
        "actualQueryCost": 10,
        "throttleStatus": {
          "maximumAvailable": 2000,
          "currentlyAvailable": 1990,
          "restoreRate": 100
        }
      }
    }
  }
}

Hi John,

Here’s a couple things you can try to troubleshoot and resolve the issue:

  1. Verify the Fulfillment Order ID: Ensure that the fulfillmentOrderId you are using matches the one returned by Shopify. In your case, the ID is "gid://shopify/FulfillmentOrder/7591739588788". Double-check that this ID is correct and corresponds to an existing fulfillment order.
  2. Check Access Scopes and Permissions: The mutation fulfillmentOrderLineItemsPreparedForPickup requires the write_merchant_managed_fulfillment_orders access scope and the fulfill_and_ship_orders permission. Ensure that your app has these permissions.
  3. Format the Input Correctly: The mutation expects an array of lineItemsByFulfillmentOrder objects, each containing a valid fulfillmentOrderId. Your input seems correct, but ensure there are no typos or formatting issues.
  4. Fulfillment Order Status: The fulfillment order must be in a status that allows it to be marked as ready for pickup. According to your query result, the status is "OPEN", which should be valid. However, confirm that no additional conditions are required for the fulfillment order to be processed.
  5. Test with a Different Fulfillment Order: If possible, test the mutation with another fulfillment order to determine if the issue is specific to this order.
  6. Debugging User Errors: The error message indicates an issue with the fulfillmentOrderId. Ensure that the ID is passed exactly as returned by Shopify, including the gid://shopify/ prefix.