This source plugin for Gatsby will make products from Spree available in GraphQL queries.
# Install the plugin with yarn
yarn add gatsby-source-spree
# or with npm
npm install gatsby-source-spree --save
In gatsby-config.js
:
module.exports = {
plugins: [
{
resolve: 'gatsby-source-spree',
options: {
host: 'http://localhost:3000'
}
}
]
};
Once the plugin is configured, the query is available in GraphQL: allSpreeProducts
{
allSpreeProducts{
edges {
node {
attributes{
name
price
purchasable
}
}
}
}
}