Structuring your data
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.
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
Updated about 1 month ago