Get only fulfilled items from order and substract numeric fields in graphql

Hi

Is there a way to request only fulfilled items and there fulfilled quantity

Today I can request totalQuantity and remainingQuantity from lineItems in Order but the things is remaining can decrease when fulfilled but also when refunded, I need to know only fulfilled quantity.

Also, another question but in the same theme, I wanted to try to request say “total-remaining”, I have seen that in graphql you could do something like

quantityDifference: totalQuantity - remainingQuantity

but it doesn’t work on shopify I guess is there a way to request a field that is a substraction from 2 integer fields?

If you want the fulfilled quantity then you need to look at the fulfillments themselves. I think you are looking at the fulfillmentorders and that will give you whats still outstanding, whereas the fulfillments are always in the past tense.. which line_items have been fulfilled and which quantity.

admin/api/2023-01/order/{order_id}/fulfillments.json

The quantity field in the line_items is the fulfilled quantity.

Shopify only supports a subset of what graphql can do.

Cheers,

Gary

1 Like

Thank you, I was searching in the wrong “fulfillments” field as you say I was in “fulfillmentOrders”.

The field I was searching for was in

fulfillments{
        fulfillmentLineItems(first:5){
          nodes{
            quantity
          }
        }
      }