Hello there,
I’m using Shopify’s GraphQL API (Python SDK) to get products, their variants and meta-fields. I’ve tested my query on Postman and Shopify Admin API GraphiQL explorer and it seems to work just fine but when use python SDK I get the following error:
{"errors":[{"message":"Field 'contextualPricing' doesn't exist on type 'ProductVariant'","locations":[{"line":27,"column":15}],"path":["query","products","edges","node","variants","edges","node","contextualPricing"],"extensions":{"code":"undefinedField","typeName":"ProductVariant","fieldName":"contextualPricing"}}]}
Here the code snippet:
products_query = """{
products(first: 5, sortKey: ID) {
edges {
cursor
node {
id
handle
hasOnlyDefaultVariant
status
tags
title
totalInventory
vendor
metafields(first: 5) {
edges {
node {
id
key
namespace
value
}
}
}
variants(first: 5) {
edges {
node {
contextualPricing(context: {}) {
price {
amount
}
compareAtPrice {
amount
}
}
sku
}
}
}
}
}
}
}"""
shopify.ShopifyResource.activate_session(shopify_session)
result = shopify.GraphQL().execute(products_query)
shopify.ShopifyResource.clear_session()
Any Ideas?
Regards,
Alex.