Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const shopify = require("@shopify/shopify-api");
- // Load the access token as per instructions above
- const storefrontAccessToken = "";
- // Shop from which we're fetching data
- const shop = "";
- // StorefrontClient takes in the shop url and the Storefront Access Token for that shop.
- const storefrontClient = new shopify.clients.Storefront({
- domain: shop,
- storefrontAccessToken,
- });
- // Use client.query and pass your query as `data`
- const products = await storefrontClient.query({
- data: `{
- products (first: 3) {
- edges {
- node {
- id
- title
- }
- }
- }
- }`,
- });
Advertisement