I am trying to retrieve all the variants of products in my store, but I keep encountering an error when trying to access the images or inventory levels of the products.
The error message states: ‘The parent ‘node’ field for a nested connection must select the ‘id’ field without an alias and must be of ‘ID’ return type. Connection fields without ‘id’: productVariants.’
My code:
query = <<~QUERY
mutation {
bulkOperationRunQuery(
query: """
{
productVariants {
edges {
node {
title
sku
product {
title
images(first: 5) {
edges {
node {
url
}
}
}
}
inventoryItem {
inventoryLevels(first: 5) {
edges {
node {
available
location {
name
}
}
}
}
}
}
}
}
}
"""
) {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}
QUERY