Skip to main content
Community Plugin
View plugin on GitHub
See starters using this

gatsby-source-spree

This source plugin for Gatsby will make products from Spree available in GraphQL queries.

Installation

# Install the plugin
yarn add gatsby-source-spree

In gatsby-config.js:

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-spree',
      options: {
        host: 'http://localhost:3000'
      }
    }
  ]
};

Querying Spree Products

Once the plugin is configured, the query is available in GraphQL: allSpreeProducts

Here’s an example query to load 10 images:

{
  allSpreeProducts{
    edges {
      node {
        attributes{
          name
          price
          purchasable
        }
      }
    }
  }
}