fulfillmentOrderLineItems in fulfillmentCreateV2

As documentation, fulfillmentCreateV2 needs to declare fulfillmentOrderLineItems to know which LineItem fulfilled.

But FulfillmentOrderLineItem.lineItem will be deprecated (https://shopify.dev/api/admin-graphql/2022-04/objects/FulfillmentOrderLineItem)

So, how can I get exactly fulfillmentOrderLineItems of the LineItem to use?

Thank you.

Hi @CedrusBlackieer :waving_hand:

The FulfillmentOrderLineItemsInput.fulfillmentOrderLineItems field of the fulfillmentCreateV2 consists of FulfillmentOrderLineItemInput.id and FulfillmentOrderLineItemInput.quantity. Once fulfillment has been assigned and your app has accepted the fulfillment request, the resulting payloads will contain the id and quantity required as part of FulfillmentOrderLineItemInput.

Below is an example assignment query and response:

{
    shop {
        assignedFulfillmentOrders(first: 10) {
            nodes {
                id
                lineItems(first: 10) {
                    nodes {
                        id
                        remainingQuantity
                    }
                }
            }
        }
    }
}

Response:

{
    "data": {
        "shop": {
            "assignedFulfillmentOrders": {
                "nodes": [{
                    "id": "gid://shopify/FulfillmentOrder/123",
                    "lineItems": {
                        "nodes": [{
                            "id": "gid://shopify/FulfillmentOrderLineItem/456",
                            "remainingQuantity": 10
                        }]
                    }
                }]
            } ...

Then the fulfillment can be created using fulfillmentCreateV2 mutation as follows:

mutation ($input: FulfillmentV2Input!) {
    fulfillmentCreateV2(fulfillment: $input) {
        fulfillment {
            id
            status
        }
    }
}

With variable inputs:

{
    "input": {
        "lineItemsByFulfillmentOrder": [{
            "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/123",
            "fulfillmentOrderLineItems": {
            "id": "gid://shopify/FulfillmentOrderLineItem/456",
            "quantity": 2
            }
        }]
    }
}

Hope that helps!