Solved

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

AW1234
Shopify Partner
44 7 12

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?

Accepted Solution (1)

garyrgilbert
Shopify Partner
397 40 165

This is an accepted solution.

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

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

View solution in original post

Replies 2 (2)

garyrgilbert
Shopify Partner
397 40 165

This is an accepted solution.

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

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
AW1234
Shopify Partner
44 7 12

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
          }
        }
      }