E-Commerce Sample Schema:

Written by Even Westvang

When you have set up a new project with `sanity init` you have had the choice between a simple film database and a blog. Our intention was to provide examples of how well known data structures are modeled in Sanity.

We've now added something slightly more substantial to sanity init: an e-commerce template.

Remember to npm install -g @sanity/cli before testing it out!

We've also made a frontend example in Vue.js and Nuxt.js with Snipcart that we're also writing up and will publish an article on in the coming days.

Transglobal Candy Store

When you install the schema you are given the choice to import some data as well – we've put together a little transglobal Candy Store with a few products, categories and vendors for you.

Yes, that's Swedish candy featuring hockey puck packaging and ammonium chloride powder.

What’s in the box

The template more or less follows the Shopify model for products and has the following bells and whistles.

Products

Products contain expected fields like:

Remember, this is just what we ship this example with. If you need to extend the schema, just add your own fields and the studio will hot reload with your new fields.

Localization

Some fields, like blurb and title are localized. Have a look at /schema/supportedLanguages.js to change what languages are available:

Internal server error