Menu

Wick Brothers - Product Models

Home / Posts / Wick Brothers - Product Models

Structuring Product Models

One of the first things to look at when building out a custom ecommerce approach, is how you might best structure your data within your platform. The logical place to start for me, is our product model. What, do we ultimately know about products? We know a few things:

  • There is some form of base data - for example, we'll sell a Soy Candle
  • There can be several variants of our base data - perhaps we'll want a 8oz and 16oz candle in multiple scents
  • Maybe we'll want to allow for some form of customization, like editing a label, or making it whatever color we want.

So, if we started modeling this out, we might see something like this:

myProduct: {
    id: "1234",
    name: "Soy Candle",
    description: "A hand-crafted candle, poured with a high-quality, 100% soy blend.",
    variants: [
        {
            name: "8oz Autumn Candle",
            sku: "AT8OZ",
            options: {
                "size": "8oz",
                "scent": "Autumn"
            }
        },
        {
            name: "8oz Christmas Hearth Candle",
            sku: "CH8OZ",
            options: {
                "size": "8oz",
                "scent": "Christmas Hearth"
            }
        },
        {
            name: "16oz Autumn Candle",
            sku: "AT16OZ",
            options: {
                "size": "16oz",
                "scent": "Autumn"
            }
        },
        {
            name: "16oz Christmas Hearth Candle",
            sku: "CH16OZ",
            options: {
                "size": "16oz",
                "scent": "Christmas Hearth"
            }
        }
    ]

}

Now, what we've done here is layout some base-level details for both the product, and then began to build out some variants within that base product. There are plenty of ways you could go about building out products like this, and even after writing that object structure, I'd likely aim to do something more simple like:

myProduct: {
    id: "1234",
    name: "Autumn Scented Candle",
    description: "A hand-crafted candle with a rich scent of fall, and poured with a high-quality 100% soy blend.",
    variants: [
        {
            name: "8oz Autumn Candle",
            sku: "AT8OZ",
            options: {
                "size": "8oz",
                "scent": "Autumn"
            }
        },
        {
            name: "16oz Autumn Candle",
            sku: "AT16OZ",
            options: {
                "size": "16oz",
                "scent": "Autumn"
            }
        }
    ]

}

To me, it would make more sense to purchase candles per-scent, but realistically I need to do some market research on what other companies are doing in that space.


Customizations

What if we wanted to add customizations? Perhaps we'd like to go back to the idea of allowing users to add a custom message to their label - maybe it's a gift for a friend. We could likely do something like this:

myProduct: {
    id: "1234",
    name: "Autumn Scented Candle",
    description: "A hand-crafted candle with a rich scent of fall, and poured with a high-quality 100% soy blend.",
    variants: [
        {
            name: "8oz Autumn Candle",
            sku: "AT8OZ",
            options: {
                "size": "8oz",
                "scent": "Autumn"
            }
        },
        ...
    ],
    customizations: {
        "labelMessage": "Happy Birthday, Ben!",
        "font": "Open Sans",
        "font-color": "blue"
    }

}

This wraps up this snippet - we built out our initial take in Strapi, so the JSON structure worked out perfect to lead into that.

Posted in Ecommerce, Startup Projects on Feb 09, 2021.