@originalfunko/shopify-collection-fetcher

0.2.0 • Public • Published

shopify-collection-fetcher

This library returns all products or ids from a Shopify collection using the GraphQL endpoint. It automatically handles pagination.


Usage:

Inside of your project, do:

yarn add @originalfunko/shopify-collection-fetcher

Simply include the library:

const shopifyCollectionFetcher = require('shopify-collection-fetcher');

Initialize your config settings:

shopifyCollectionFetcher.init({
    SHOPIFY_API_URI: '<API_URI>',
    SHOPIFY_API_TOKEN: '<API_TOKEN>',
});

Then call it as needed:

let productsResult = await shopifyCollectionFetcher.fetchIt(id);
let productIds = await shopifyCollectionFetcher.parseIt(id, productsResult);
products = products.concat(productIds);

Configuration:

Beyond the SHOPIFY_API_URI and SHOPIFY_API_TOKEN settings (which will inherit process.env.SHOPIFY_API_URI and process.env.SHOPIFY_API_TOKEN if available), here is the complete list of settings:

shopifyCollectionFetcher.init({
    SHOPIFY_API_URI: '<API_URI>',
    SHOPIFY_API_TOKEN: '<API_TOKEN>',
    SHOPIFY_API_RATE_LIMIT: 50,
    SHOPIFY_API_GRAPHQL_PRODUCTS: 20,
});

Readme

Keywords

none

Package Sidebar

Install

npm i @originalfunko/shopify-collection-fetcher

Weekly Downloads

0

Version

0.2.0

License

MPL-2.0

Unpacked Size

25.2 kB

Total Files

4

Last publish

Collaborators

  • dannyatfunko
  • freddyfunko
  • tdestefano
  • tprobinson
  • gregatfunko
  • ryanpcmcquen
  • vimcat