Product Variants / Combinations

Options
Joseph
Joseph Member
edited November 2022 in ? Transforming data

Hi all,

I would like to create a combination of products for the different options that may be available. So for example, a T-shirt may have:

  1. sizes [S, M, L]
  2. colours [red, green, blue]

That gives 9 (3x3) combinations. How would one go about working the function stack?

Any/all help is greatly appreciated! :)

Answers

  • nocodetalks
    nocodetalks Member ✭✭
    edited November 2022
    Options

    Do the pricing affect the color or size changes?


    @Joseph

  • Joseph
    Options

    Hi @nocodetalks, yes somewhat. Its more like the size/colour will affect the pricing. Like a bigger size would be more expensive.

  • nocodetalks
    nocodetalks Member ✭✭
    Options

    Treat "color" and "sizes" as the add-on.

    The product will have the base price, and if the user changes the colour and size then the "add-on" price will be added to the base price.

    Create two tables, "Color" and "size". Now add the different colors and sizes available to the product into this table.

    Product table should have a reference to these "color" and "size" with a list of item.


    @Joseph

  • Joseph
    Options

    Thanks for that, will give that a go

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    @Joseph this is the domain of SKU (stock-keeping unit) management. Most e-commerce systems would treat each combination as an inventory item to be sold. So if you have nine possible t-shirts each with different prices, you might reflect them as nine possible products in your system. That makes the logic much easier - you're just pulling nine records from your product table to reflect the SKUs.

    But I'd start with a small grounding on what SKUs are in e-commerce so you can make an informed decision of how to integrate the idea into your system. Here's a primer: https://www.bigcommerce.com/ecommerce-answers/what-is-a-sku-how-online-business-use-it/

    We discuss these kinds of higher-level questions during our daily office hours on State Change Pro.