Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save drinkmorewaters/19f504cfe3172513cd1b39d0cf6cb694 to your computer and use it in GitHub Desktop.
Save drinkmorewaters/19f504cfe3172513cd1b39d0cf6cb694 to your computer and use it in GitHub Desktop.
Get products from the unoptimised Shopify SDK
// 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