Shopify

libs.shopify.get()

Requires the Shopify integration to be set up
Returns an instance of Shopify-api-node library, with the credentials already set up. You can then call Shopify APIs directly, like the following.
Example: Rest API get product tag
const shopify = libs.shopify.get();
const { tags } = awai
Example: GraphQL get product tag from order
const shopify = libs.shopify.get();
const query = `{
order(id: "gid://shopify/Order/${orderID}") {
id
tags
lineItems (first: 100) {
edges {
node {
id
product {
id
tags
}
}
}
}
}
}`;
const { order } = await shopify.graphql(query);
Multiple Shopify integration
// if you have added multiple shopify integration to the same app,
// you can access them like this:
const shopOne = libs.shopify.get('shopOne.myshopify.com');
const shopTwo = libs.shopify.get('shopTwo.myshopify.com');
...
Last modified 1yr ago