Solved

What is exactly currentQuantity?

AW1234
Shopify Partner
44 7 12

Hi,

I would like to know what exactly is currentQuantity in this following query

{
  order(id: "<any id>") {
    lineItems(first: 20) {
      nodes {
        sku
        currentQuantity
        unfulfilledQuantity
      }
    }
  }
}

I use it to know how many of a sku I fulfilled by doing current - unfulfilled, it works fine but sometimes I have an order wich I have 0 in currentQuantity, but I fulfilled them...

I thought currentQuantity was the field quantity - refunded quantity as it works for most of my operations.

thanks a lot in advance

Accepted Solution (1)
AW1234
Shopify Partner
44 7 12

This is an accepted solution.

Nevermind, I will try something else as this will never work how I want it to work, thanks anyway

View solution in original post

Replies 3 (3)

garyrgilbert
Shopify Partner
397 40 162

Hi There,

 

According to the documentation currentQuantity: 

 

The line item's quantity, minus the removed quantity.

 

If you want to find out how many you need to fulfill for the order you need 'unfulfilledQuantity'.

 

But you should really be using the quantities available on the fulfillmentOrder endpoint instead of the order lineItems

- 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

Hi,

thanks for the reply,

I should have precised that I am using a bulk operation, so can't nest more than 2 connections or else I have this error: Bulk queries cannot contain connections with a nesting depth greater than 2

and also because it's a bulk query I have Queries that contain a connection field within a list field are not currently supported

that's why I don't/can't use every field I want (or I have to query 2x for the same order) (yes i'm struggle on this since a long time)

 

And I want to find how many I already fulfilled not unfulfilled, I have remainingQuantity for that

 

here is my request to have a better view:

mutation {
        bulkOperationRunQuery(
          query:"""
          {
           orders(query:"created_at:>='${date.toISOString().split('.')[0]}Z' AND (fulfillment_status:shipped OR fulfillment_status:partial)"){
            edges{
              node{
                id, name,
                lineItems{
                  edges{
                    node{
                      id,
                      sku,
                      currentQuantity,
                      unfulfilledQuantity
                    }
                  }
                }
                fulfillmentOrders {
                  edges { 
                    node {
                      id,
                      lineItems {
                        edges {
                          node {
                            id, remainingQuantity, totalQuantity, sku
                          }
                        }
                      }
                      fulfillments {
                        edges {
                          node {
                            id
                            trackingInfo {
                              number
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
        """
      ) {
        bulkOperation {
          id
          status
        }
        userErrors {
          field
          message
        }
      }
    }
AW1234
Shopify Partner
44 7 12

This is an accepted solution.

Nevermind, I will try something else as this will never work how I want it to work, thanks anyway