Docs
dashboard/variants

Product Variants

Product variants is a staple feature, that every merchant should know about and use.

But, what are they exactly ?

So, let's suppose you are selling a branded t-shirt ๐Ÿ‘• and let's suppose that the shirt

  • has many sizes small / medium / large
  • and the shirt has two colors red / white

You may start to feel, that products are usually manufactured with different flavours in order to appeal to a wider consumer markets and rightfully so.

small medium large
red โœ…โœ…โœ…
white โœ…โœ…โœ…

Let's iterate all the possible 6

variants
:

  • a small, red shirt
  • a small, white shirt
  • a medium, red shirt
  • a medium, white shirt
  • a large, red shirt
  • a large, white shirt

Yep, Each variant is a combination

Storecraft supports product variants. With storecraft, we have a main product and each variant is a child product with it's own handle and specific data such as images, description, stock and pricing.

Let's see an example and a developer guide

Guide

First, let's edit or create a new product

Let's create one of the variants.

  • Click on the create button next to Large / White variant.
  • A new product page will show with somw filled data (based on the parent product)
  • Fill up it's pricing, description and stock
  • click create
  • go back to the main product

Now, you will see the green check mark next to it

Don't forget to save

Developer guide

First of all, each variant in the database is a product on it's own right. This helps with unified checkout and search functions.

๐Ÿ’ก Reminder, each variant is a child product of the main product

Every variant product is ALSO embedded in the parent product through the variants_products property found in ProductData, this helps when loading the parent product, then all of it's children products are just there.

Each option with it's id and values (and ids) are recorded in the parent product's product_options field.

Each handle in variants_products maps into VariantCombination which tells exactly the option ids and selection ids that trigger this variant product .

Here is a sample json that explains these relations

๐Ÿ’ก If a product has a parent_handle property, then it is a variant of the parent product, you can also watch the _product_hint property, which tells which options seclections it triggers

All Rights Reserved, storecraft, (2025)