0.4.8 • Published 4 years ago

gatsby-source-bigcommerce-updated-proxy v0.4.8

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

gatsby-source-bigcommerce

This is a fork of the original. This pull request describes the minor difference.

This source plugin makes Big Commerce api data available in gatsby.js sites

Installation

# Install the plugin
yarn add gatsby-source-bigcommerce

in gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-bigcommerce',
      options: {
        ...
      }
    }
  ]
};

Configuration options

follows node-bigcommerce api

example configuration for a single endpoint:

options: {
  // REQUIRED
  clientId: 'yourClientID',
  secret: 'YourClientSecret',
  accessToken: 'yourAccessToken',
  storeHash: 'yourSiteHash',
  endpoint: '/catalog/products',

  // OPTIONAL
  logLevel: 'info',
  nodeName: 'BigCommerceNode',
  apiVersion: 'v2'
}

If you want to return data from multiple endpoints, use endpoints instead. You can find a list of endpoints here.

options: {
  ...

  // Create a nodeName and map it to a BigCommerce endpoint
  endpoints: {
    BigCommerceProducts: "/catalog/products",
    BigCommerceCategories: "/catalog/categories",
  }
}

How to query

{
  allBigCommerceNode {
    edges{
      node{
        name
        price
        id
        sku
      }
    }
  }
}

Preview

This currently supports use in Gatsby Cloud. Preview only supports product updates add the preview key to options as shown

options: {
  preview: true;
}

Once your instance is deployed in Gatsby Cloud, get your preview URL and add it as an environment variable under the key SITE_HOSTNAME.

Restart your instance and preview should be live.

credit

thanks to all the contributors to node-bigcommerce