Last active
June 20, 2020 03:08
-
-
Save drinkmorewaters/19f504cfe3172513cd1b39d0cf6cb694 to your computer and use it in GitHub Desktop.
Get products from the unoptimised Shopify SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Build a custom products query using the unoptimized version of the SDK | |
const productsQuery = this.props.client.graphQLClient.query((root) => { | |
root.addConnection('products', {args: {first: 12}}, (product) => { | |
product.add('title'); | |
product.add('tags'); | |
product.addConnection('variants', {args: {first: 12}}, (product) => { | |
product.add('id') | |
product.add('price') | |
}) | |
}); | |
}); | |
// Call the send method with the custom products query | |
this.props.client.graphQLClient.send(productsQuery).then(({model, data}) => { | |
// Do something with the products | |
console.log('unoptimised', model); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment