In commercetools, a product is a sellable good or service. A product can be material or immaterial. Some examples of products include:
- A pair of shoes
- A mobile phone plan
- An ebook
- A license
- A file
On data level, Products are based on a Product Type selected when created. They can only define values for the Product Attributes a Product Type has defined.
Product information is stored in two dimensions: Product Attributes and Product Variants. Product Attributes describe individual properties of a product, and Product Variants describe individually sellable variations of a particular product.
The key consideration when modeling products is deciding what to model as Product Attributes and what to model as Product Variants. Often sellable goods of a business are almost the same in most aspects, but differ in just one or some Product Attributes. These can then be handled as Product Variants and be grouped in one parent product.
Products: keep in mind
Keep the following in mind when thinking about what products to create:
- Remember the commercetools’ platforms limits: if a Product has too many Product Variants, it might approach the JSON document size limit. In general, it’s better to have more Products which have less Product Variants.
Products: helpful questions
When modeling products, ask yourself the following questions:
- What characteristics of my product do I need to capture?
- What should be a Product Variant or a Product? Try it out a few different ways before committing to anything.
Product Variants generally represent a distinct SKU or sellable good. In some cases, like Products which have various sizes, they represent a group of sellable goods which are identical except for one or two Product Attributes.
These attributes which differ are generally not usable as sorting or ordering selectors (site navigation), and therefore aren’t modeled as categories, but are more useful as filters for search results.
For example, a clothing store might have a product, “Women’s Pants” which has the following variants:
- Red Women’s Pants in size 36
- Green Women’s Pants in size 38
- Green Women’s Pants in size 40
When to use variants
Using variants is a key decision which must be made before importing your product data into commercetools.
Product variants are a powerful way to model catalog data, but can lead to issues with data size. For example, if you model a Product Variant for each size of pant and each color available, this quickly results in a large data set.
When deciding to use product variants, try multiplying the variable attributes with each other. This gives a rough idea of how many variants a product might have.
For example, 5 colors, 10 sizes and 4 fabrics make a selection of 200 possible combinations. You can model this as a single Product which has 200 Product Variants, but we’d recommend modeling this as multiple products instead, taking one of the variable attributes (color or fabric, for example) and using that as a Product.
Best practices: products, variants and attributes
Let’s revisit the diagram of the Product Data Model:
As we mentioned previously, Products contain Product Variants, and they all contain Product Attributes. From a data complexity standpoint, this means the data for a single Product can increase exponentially very quickly, and reach the JSON document size limit. In particular, creating Products which have too many Product Variants can quickly cause performance decreases.
When modeling products, be mindful of the amount of data which will be generated for any one Product. It’s important to be strategic what you choose to model as a Product Variant and what the purpose of a Product Attribute is. In general, we recommend creating more Products with less Variants.
In general, approach modeling your Products with the following workflow:
- Analyze the current product set’s product attributes. Pay attention to which attributes are common to all (or a group of) products, and which are not.
- Decide on your major product groups, and what their common attributes are. These will become your product types.
- Decide on the granularity of a Product and a Product Variant. In general, more Products with less Variants is recommended.
- Try out a few different options: Don’t commit to a product model before seeing if it will work in some typical and not-so-typical scenarios!
Keep in mind the following when modeling products:
- product URL slugs, display names, and search keywords are modeled on products, not variants: Keep this in mind when optimizing your product modeling for SEO purposes.
- product names are weighted 6x more heavily than other attributes in full text searches: When naming products, select a name carefully that doesn’t use terms which only apply to one variant.
- Tax categories are modeled on the product level: when deciding on what variables to model as product variants, keep in mind that all variants must share the same tax category.