Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

GraphQL Syntax Error

alinh1803
Shopify Partner
1 0 0

Hey there,

 

I got this error:

syntax error, unexpected STRING (\", \") 

after I use the following query:

 

query ProductsQuery($cursor: String) {
products(first: 1000, after: $cursor) {
edges {
node {
__typename
id
variants {
edges {
node {
__typename
id
... on ProductVariant {
inventoryQuantity
inventoryPolicy
inventoryManagement
inventoryItem {
id
requiresShipping
tracked
inventoryLevels {
edges {
node {
id
location {
id
}
quantities(names: ["available", "on_hand", "reserved", "committed"]) {
name
quantity
}
}
}
}
}
}
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}

 

I am a beginner in GraphQL and I tried to find all the available solutions, but nothing worked successfully.

 

If I remove:

 

quantities(names: ["available", "on_hand", "reserved", "committed"]) {
name
quantity
}

 

The query will run normally, but I need the quantities for my tasks. Can anybody please help me with this error?

 

And I'm sorry if the way that I asked doesn't satisfy you.

 

Thank you.

 
Reply 1 (1)

Liam
Shopify Staff
2646 287 726

Hi Alinh1803,

 

The `inventoryManagement` field on ProductVariant is deprecated - if you remove this, is it working?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog