How to map return line item with Fulfillment items?

Hi,

I want to map return line items with order fulfillment items. Is there any way to map it ? As while creating new return using returnCreate endpoint I am passing fulfillmentLineItemId in returnLineItems but when I fetch the return I am not getting this id against the ReturnLineItem.

Kindly guide.

Thanks.

Hi @Maulik_Shah_RAB - the fulfillmentLineItem field does exist on ReturnLineItem - the trick is that returnLineItems returns the ReturnLineItemType interface rather than the type, so you need an inline fragment to access it:

query getReturn($id: ID!) {
  return(id: $id) {
    returnLineItems(first: 10) {
      nodes {
        ... on ReturnLineItem {
          id
          quantity
          fulfillmentLineItem {
            id
            lineItem {
              id
              name
              sku
            }
          }
        }
      }
    }
  }
}

This came up a few times before - same solution worked in this thread and this one.

Thank you for your help. @Donal-Shopify

1 Like

Happy to help Maulik!