Structuring your data (WIP)

Series: Building an e-commerce frontend with Tweakwise

In this series we’ll walk you through building a robust e-commerce platform using Tweakwise, using industry best practises.

Setting a strong foundation is important. In this first part, we’ll explore how to organize your data to get the most out of Tweakwise.

In this part:

  • We'll explain how we see the relation between products
  • Give pointers for choosing an approach
  • Set some industry best practises

Concept

In e-commerce industries like fashion, product data is usually stored using parent/child relations or variations.
For example, a Tweakwise Hoodie is available in two colors or a Tweakwise Sneaker is available in 5 sizes.

In Tweakwise, the concept of main products with variants does not exist; instead, group keys are used for product grouping. To learn more, see Groupcodes.

Group keys provide the necessary flexibility for grouping products based on specific attributes, ensuring a tailored product display without relying on a main product/variant structure.

Common approaches for this are:

  • Variation-based grouping: One item for each variation
  • Main product-based grouping: One item for each main product

Choosing the right approach

To choose between the two, one of the main decision factors is the availability of data. If you data source supports variants, always choose the Variation-based approach.

This has the following advantages:

  • For a search query, the API response will give the most relevant product response.
    For example typing “grey hoodie” will return the entire group, but will have the grey variant as main image.
  • You can individually update the price, availability, or any other attribute of a variant.
  • It gives maximum flexibility in the way you can display your products throughout your platform. For example, if you search for "hoodie" and:
    • you only want to see one main product, with color indications on the tile, use the Grouped search endpoint.
    • you want to see all colors, use the regular Search endpoint.

Recommended configuration

todo: dit is een voorstel vanuit chatgpt, per markt (csm) bepalen of dit wel/niet kan of handig is.

Fashion

  • Colors: Tweakwise Hoodie in red, blue, or black.
  • Sizes: Tweakwise Sneakers in EU sizes 38–46.
  • Styles: Tweakwise Dress in sleeveless, long-sleeve, or strapless versions.

Living

  • Materials: Sofa available in leather, velvet, or fabric.
  • Dimensions: Dining table available in 4-seater, 6-seater, or extendable sizes.
  • Colors/Finishes: Coffee table in oak, walnut, or black lacquer.

DIY

  • Dimensions: Wooden planks in lengths of 1m, 2m, or 3m.
  • Power Ratings: Drills available in 500W, 750W, and 1000W.
  • Material Types: Paint in matte, gloss, or satin finishes.

Electronics

  • Specifications: Laptop with 8GB, 16GB, or 32GB RAM.
  • Colors: Smartphone available in black, white, or blue.
  • Storage Options: Tablet with 64GB, 128GB, or 256GB storage.

Food

  • Packaging Sizes: Pasta in 500g, 1kg, or 5kg options.
  • Dietary Variants: Bread in regular, gluten-free, or wholegrain.

Wholesale

  • Pack Sizes: Industrial gloves in packs of 10, 50, or 100 pairs.
  • Grade Variations: Steel sheets in standard, premium, or ultra-grade.
  • Unit Types: Screws available individually or in bulk boxes.

Examples

Fashion

In e-commerce industries like fashion, product data is usually stored using parent/child relations or variations.

For example:

  • Colors: Tweakwise Hoodie in red, blue, or black.
  • Sizes: Tweakwise Sneakers in EU sizes 38–46.
  • Styles: Tweakwise Dress in sleeveless, long-sleeve, or strapless versions.

Common approaches in fashion:

  • Variation-based (recommended):
    Use groupcode for the main dimension, like color, supporting dimensions (like size) can be modelled using attributes.
    Example: Tweakwise Hoodie or Tweakwise Hoodie Blue.
  • Main product-based:
    Do not use groupcodes. Some dimensions are main products, other are modelled using attributes.
    Example: Tweakwise Hoodie.

Example: Variation-based grouping

Considering the Hoodie with two colors and three sizes, the feed should contain one item per variation:

<items>
  <item>
    <id>nl_NL_101</id>
    <name>Tweakwise Hoodie</name>
    <groupcode>NL_100</groupcode>
    <attributes>
      <attribute>
        <name>Color</name>
        <value>Blue</value>
      </attribute>
      <attribute>
        <name>Size</name>
        <value>S</value>
      </attribute>
      <attribute>
        <name>Size</name>
        <value>M</value>
      </attribute>
      <attribute>
        <name>Size</name>
        <value>L</value>
      </attribute>
    </attributes>
  </item>
  <item>
    <id>nl_NL_102</id>
    <name>Tweakwise Hoodie</name>
    <groupcode>NL_100</groupcode>
    <attributes>
      <attribute>
        <name>Color</name>
        <value>Grey</value>
      </attribute>
      <attribute>
        <name>Size</name>
        <value>S</value>
      </attribute>
      <attribute>
        <name>Size</name>
        <value>M</value>
      </attribute>
      <attribute>
        <name>Size</name>
        <value>L</value>
      </attribute>
    </attributes>
  </item>
</items>

Example: Main product-based grouping

Considering the Hoodie with two colors and three sizes, the feed should contain only one item for each main product:

<items>
  <item>
    <id>nl_NL_101</id>
    <name>Tweakwise Hoodie</name>
    <attributes>
      <attribute>
        <name>Color</name>
        <value>Blue</value>
      </attribute>
      <attribute>
        <name>Color</name>
        <value>Grey</value>
      </attribute>
      <attribute>
        <name>Size</name>
        <value>S</value>
      </attribute>
      <attribute>
        <name>Size</name>
        <value>M</value>
      </attribute>
      <attribute>
        <name>Size</name>
        <value>L</value>
      </attribute>
    </attributes>
  </item>
</items>


Good to know

  • The XML examples are strongly simplified for demonstration purposes