A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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 👋
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!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog