A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi,
I'm using the unoptimised buy SDK to create a query to get the tags on product items.
The docs here have a nice example:
https://shopify.github.io/js-buy-sdk/
// Build a custom products query using the unoptimized version of the SDK const productsQuery = client.graphQLClient.query((root) => { root.addConnection('products', {args: {first: 10}}, (product) => { product.add('title'); product.add('tags');// Add fields to be returned }); });
However, when I send this query I always get null returned. If I remove the tags then it works as expected. E.g this deos work:
// Build a custom products query using the unoptimized version of the SDK const productsQuery = client.graphQLClient.query((root) => { root.addConnection('products', {args: {first: 10}}, (product) => { product.add('title'); // tags removed and it works }); });
From testing I seem to be able to add any field, apart from the `tags`.
Any ideas how to get the `tags` returned?
Many thanks for any help in advance.
Not sure how you have set this up, but when I give it a spin over at codepen, it works as advertised.
See for yourself (just add your storename and API token). Should work.
I was annoyed not having tags by default on the SDK and having to try to do all the custom stuff with "unoptimized" package. Everything else is exactly the same as the original SDK - https://www.npmjs.com/package/shopify-buy-with-tags