Solved

currentQuantity doesn't exist on type LineItem

PaulBeuk
Visitor
2 0 0

Hello,

Hope you can help me. I noticed for the actual quantity in an order I need to use currentQuantity and not quantity.  See:
https://shopify.dev/docs/admin-api/graphql/reference/orders/lineitem#fields-2021-04

But unfortunately I get this errormessage in return:

{"errors":[{"message":"Field 'currentQuantity' doesn't exist on type 'LineItem'","locations":[{"line":1,"column":176}],"path":["query","orders","edges","node","lineItems","edges","node","currentQuantity"],"extensions":{"code":"undefinedField","typeName":"LineItem","fieldName":"currentQuantity"}}]}

See the template I use. Without field currentQuantity the query works fine.

{"query":"query{orders(query:\"status:open\",first:${ordernumbers}<#if cursor??>, after: \"${cursor}\"</#if>){pageInfo{hasNextPage,hasPreviousPage},edges{cursor,node{name,displayFulfillmentStatus,lineItems(first: 3) {edges {node {id,quantity,currentQuantity,fulfillmentStatus,product{id},variant{id},title,variantTitle,sku,discountedUnitPriceSet{shopMoney{amount,currencyCode}}}}}id,email,createdAt,customer{id},discountCode,totalDiscountsSet{shopMoney{amount}},totalShippingPriceSet{shopMoney{amount}},shippingAddress{firstName,lastName,address1,address2,city,zip,country,phone}}}}}"}

Thanks in advance,
Paul

Accepted Solution (1)

ManuelKruisz
Shopify Partner
16 4 7

This is an accepted solution.

Hi,

are you sure you're using the latest API version (2021-04) in your app? Looks like the field wasn't present in 2021-01 and older API versions.

Hope I guessed it right 😉
Regards,
Manuel

Freelance Developer.
I customize themes, optimize stores and develop apps.
www.manuelkruisz.com

View solution in original post

Replies 2 (2)

ManuelKruisz
Shopify Partner
16 4 7

This is an accepted solution.

Hi,

are you sure you're using the latest API version (2021-04) in your app? Looks like the field wasn't present in 2021-01 and older API versions.

Hope I guessed it right 😉
Regards,
Manuel

Freelance Developer.
I customize themes, optimize stores and develop apps.
www.manuelkruisz.com
PaulBeuk
Visitor
2 0 0

Thanks Manuel, I did not realise there is already a later version available. The call works fine now!