gatsby-source-swell

This source plugin connects Gatsby to Swell’s Node API, which gives you access to the store data (categories, products, etc.) necessary to build an e-commerce storefront.

Features

  • Provides public shop data available via the Swell API

    • Categories
    • Products
    • Product Attributes
    • Product Variants
    • Coupons
    • Promotions
  • Supports gatsby-transformer-sharp and gatsby-image for product images

Install

yarn add @marichelle/gatsby-source-swell

How to use

In your gatsby-config.js add the following config to enable this plugin:

plugins: [
  /*
   * Gatsby's data processing layer begins with “source”
   * plugins. Here the site sources its data from Swell.
   * The client uses your store ID and secret key for
   * authorization. You can find these in your
   * Dashboard under Settings > API.
   */
  {
    resolve: 'gatsby-source-swell',
    options: {
      // The domain name of your Swell store. This is required.
      storeId: 'swell-store-id',
      // The key used to access your data by API. This is required.
      secretKey: 'swellStoreSecretKey',
      // List of data types you want to fetch.
      // Defaults to ['category', 'product'].
      dataTypes: [
        'category',
        'product',
        'attribute',
        'variant',
        'coupon',
        'promotion',
      ],
    },
  },
]