Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

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 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',
      ],
    },
  },
]
© 2024 Gatsby, Inc.