Product variation in marketplace

I want to create a functionality where the merchant can create/add a product with multiple variation, for example tshirt size and color combination. Im stuck on how to structure this in a database . Also on how to retrieve this on product page. I would appreciate if anyone can help

Hi there!

You could add a variation to a product by either creating a list of variations field to the product or adding a product field to the variation data type.

To retrieve the variation on the product page you could do either reference to the product’s variation list field or search for variations with a constraint of the page’s product.

Here’s how the db structure could look like:

List:

Product:

  • Product name
  • Product Description
  • List of variations (Variation data type)

Adding the product in the variation:

Variation:

  • Variation Name
  • Variation Description
  • Product (Product data type)

To create a variation, you just create the variation data and add it in the list of variations field or add the product in the variation’s product field (depending on which route you would do)

Hi

Thanks for the tip, Im working on it, currently I’m stuck in displaying the product price after the end-user select variants field from 2 dropdowns, I mean displaying the default price and also change the price whenever another variants selected from the combination of dropdowns. Ive put the price of each variation in the variation database.