🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Discussing optimal schema for product variants in Sanity with Stripe/PayPal

18 replies
Last updated: Feb 12, 2021
Battling with the notion of product “variants”! Is there any reason it would be unhelpful to craft your schema as:

Title
Artists (reference to maker[s])
Variants Label (e.g. "Size")
Variants (array, if only one type of product, only one variant)
    Title
    Price
    Quantity
    SKU
    Tax Level
    Weight
Body
Details
Categories
Essentially – omit the “Default” variant fields you see in Shopify-type schema, and simply store ALL variants in an array? If there’s no variants, there would only be one item in “Variants” and no “Variant Label”

Its frustrating when you have a store where variations will be relevant for less than 2% of products…
Feb 12, 2021, 2:01 PM
i typically ignore variants entirely if there is only 1
Feb 12, 2021, 3:12 PM
especially in my mounting and displaying of product information
Feb 12, 2021, 3:12 PM
Interesting! Thanks User. But then how does it work if you have a range of sizes, S, M, L, XL etc. – is the default variant titled “S” and added to the list of options?
Feb 12, 2021, 4:50 PM
are you using shopify? or implementing your own instance of shopify-like?
Feb 12, 2021, 4:53 PM
I’m literally just building with Sanity and Stripe/PayPal integrations, been great so far – some basic stuff for emails, orders etc. – but never needed variants before! It’s a little perplexing for me
Feb 12, 2021, 5:05 PM
So yes I have total freedom, which is probably the root of my confusion – I’m used to being prescribed a logic and having to accept it
Feb 12, 2021, 5:07 PM
ah
Feb 12, 2021, 5:07 PM
if you’re handling it, I would just not associate variants with products that don’t have them if you don’t need to
Feb 12, 2021, 5:08 PM
you don’t have to follow the shopify pattern of default variant if you don’t want to
Feb 12, 2021, 5:08 PM
especially if you have full control of sku/inventory
Feb 12, 2021, 5:08 PM
you really have full freedom to optimize specific for your use case
Feb 12, 2021, 5:08 PM
just make sure it can scale with some level of complexity (like size + color)
Feb 12, 2021, 5:09 PM
doesn’t have to be a single tier of
all variatns
like shopify either
Feb 12, 2021, 5:09 PM
add a size array for sizes, color array for colors
Feb 12, 2021, 5:09 PM
Yeah that’s a thing – it’s a charity who will largely just sell artworks, posters etc. – but then I know they will throw a spanner in the works and want to sell a t-shirt in a range of sizes or something, at some point, but not idea what these will be until they decide to do them.
Feb 12, 2021, 5:10 PM
ahhh that could be a great idea! (sizes array)
Feb 12, 2021, 5:11 PM
thanks User
Feb 12, 2021, 5:12 PM
food for thought…
Feb 12, 2021, 5:12 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?