Happening now! Exclusive AMA: Streamlining Fulfillment and Delivery with Shopify Experts | Ask your questions to be answered by our team!

Buy SDK Graphql not returning tags with documented example

Buy SDK Graphql not returning tags with documented example

rpk98c
Shopify Partner
1 0 0

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. 

Replies 2 (2)

KarlOffenberger
Shopify Partner
1873 184 901

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.

Spencer_Snyder
Shopify Partner
2 0 1

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