Unopinionated bare-bones Gatsby + Sanity + Shopify starter
BIG thanks to 🍝Kevin Green🍝 for the serverless function.
Clone this repository to bootstrap a fresh Gatsby site, powered by Sanity CMS and dynamically import Shopify products to Sanity with the help of a Web Hook.
Note: This repo is purposely barebones so that you can employ your favorite CSS framework, create your sanity schemas, etc. For a more ‘out of the box’ starter, check out Midway by Kevin Green or HULL which is a great Next/Sanity/Shopify starter.
rm -rf .git
studio
folder run sanity init
and create a new project.studio/sanity.json
and update the Project ID.studio/package.json
.deskStructure.js
export (include a fun icon!)READ/WRITE
API token. You’ll need this for the Netlify serverless function.env.example
to .env
by typing mv env.example .env
in your terminal..env
file.gatsby-config.js
and add your site title, etc.functions/
folder in your project.Settings -> Notifications -> Webhooks
and create webhooks for Product Creation, Updates, & Deletions (⚠️ Be careful with how you implement this, see more here). Set the webhook’s Callback URL to [https://YOUR_URL.DOMAIN/.netlify/functions/shopify]
(if using Netlify, otherwise point to your provider’s Lambda location)A blank slate Gatsby site w custom webhook to create new Shopify products
Sanity Studio with a schema for
title
, slug
, defaultPrice
, id
, productId
.id
, productId
, variantId
, title
, variantTitle
, sku
, and price
.web/functions/shopify
file will generate new Sanity documents with these default fields.This entire repo is really just merged together from a stripped-down version of Sanity’s Sample company website built with Gatsby & Sanity.io repo and a modified version of Kevin Green‘s lambda function as discussed in the Sanity + Shopify Roundtable: Headless ecommerce with Kevin Green & Joseph Thomas video.
MIT