Got "Invalid fulfillment order line item quantity requested." in fulfillmentCreateV2 mutation

Solved
sakuraischerry
Tourist
8 0 2

I got an invalid error when I use fulfillmentCreateV2 mutation.

 

Mutation:

mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
  fulfillmentCreateV2(fulfillment: $fulfillment) {
    fulfillment {
      id
    }
    userErrors {
      field
      message
    }
  }
}

 

Query variables:

{
  "fulfillment": {
    "lineItemsByFulfillmentOrder": [
      {
        "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/12345",
        "fulfillmentOrderLineItems": [
          {
            "id": "gid://shopify/FulfillmentOrderLineItem/12345",
            "quantity": 1
          }
        ]
      }
    ]
  }
}

 

Response:

{
  "data": {
    "fulfillmentCreateV2": {
      "fulfillment": null,
      "userErrors": [
        {
          "field": [
            "fulfillment"
          ],
          "message": "Invalid fulfillment order line item quantity requested."
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1990,
        "restoreRate": 100
      }
    }
  }
}

 

I confirmed the order id, the line item id, and the quantity are correct. Does anyone have any solutions?

Accepted Solution (1)

Accepted Solutions
tolgapaksoy
Shopify Partner
91 7 55

This is an accepted solution.

What does

gid://shopify/FulfillmentOrder/12345

look like? Can you echo the status of the fulfillment order and its line items here? The API seems to be complaining that this fulfillment order does not have enough quantity for the line item. Maybe the FulfillmentOrder was already fulfilled and the status might be IN_PROGRESS or CLOSED.

View solution in original post

Replies 2 (2)
tolgapaksoy
Shopify Partner
91 7 55

This is an accepted solution.

What does

gid://shopify/FulfillmentOrder/12345

look like? Can you echo the status of the fulfillment order and its line items here? The API seems to be complaining that this fulfillment order does not have enough quantity for the line item. Maybe the FulfillmentOrder was already fulfilled and the status might be IN_PROGRESS or CLOSED.

sakuraischerry
Tourist
8 0 2

Oh, you are right. That line item is fulfilled. Thank you!