Database structure for quantities and sizes of Product


I’m fairly new to bubble and have come across my first problem that I can’t figure out myself or found any help via other posts to solve my problem.

I’m trying to build a marketplace for seller’s to list items of clothing that customers can buy. I’ve managed to do most the simple stuff like adding product names images etc. into a database then showing those products to the customer via a buyers page. But am now getting stuck on some of the product specific things… mainly sizing, quantities and how best to store that in the database and linking it all together.

  1. As its clothes I want there to be different pre-set sizing’s which the seller can choose from for their products, so for example, is this piece of clothing sized in ‘Small, Medium, Large’ or is it lets say a women’s bra so the sizing will be A cup, B cup, C cup and so on…

  2. Once selected I want the seller to be able to list how many of each size they have for sale. So once a customer was to purchase it can take 1 quantity of that size purchased off the sellers inventory of that product.

If that doesn’t make sense I’ll try example how I want it to work below:

So lets say they have a T-shirt for sale. The seller has added a new product to his products page inputting image, description, male or female and what sizing they would like to use from a list of options inputted by a checkbox, now they just need to go to inventory and select what sizes and quantities they have in stock.

They click on update inventory and a popup appears which auto populates the sizing fields (lets say this T-shirt comes in Small, Medium or Large) so in a repeating group it would populate Small, Medium, Large. Then next to these sizes they can input how many they have of each size (say 5 of each).

So then the product is listed on the marketplace and once a customer purchases one medium it will then reduce the sellers inventory of the medium down to 4 and so on until sold out.

Hope that all makes sense and as mentioned above its mainly the database side of things I’m struggling with and how to store it all.

Thanks in advance,


1 Like

Hi Charlie,

Sam here, with Bubble support. I would set up two data types: Product & Inventory Item. Then, you can use option sets to store the values for sizes, colors, etc.

As long as the two data types relate to each other, you can integrate them in a nested repeating group setup that can display all details about a product and its inventory in one spot.

Here’s a video that should help explain a bit more clearly:

I hope this helps! Happy to answer any additional questions you may have.

Hi Sam

Really appreciate the detailed video it has really helped a lot and I’ve managed to sort out saving indidual sizes and quantities to each product. However I am trying to build something a bit more user friendly and will attach a screenshot of what I have quickly done as an example of how I would like it to look/work.

Basically I’d like the seller to select from the dropdown menu what type of sizing they would like to use (XS-XL or 0,2,4,6 or shoes sizes etc) then the below repeating group will load said sizings into each row and then the seller can just input the quantity of each they have. Then finally at the bottom have a save button to send the relevent data to the database.

Let me know if this is even possible. I have again tried to work it out myself but keep going round in circles not finding a soloution.


Hi Charlie,

This is certainly possible and would use the same data structure described in my video above. When you click “save,” you’ll end up creating various “inventory items” based on the sizes and quantities that your user entered. For example, each individual size would be its own “inventory item” tied to a quantity and a product. If the product doesn’t exist yet, you should create it!

In other words, the user interface and front end design can be whatever you want and as simple / straight forward as you want - but the backend data should still be structured in the same way.

If you’re having trouble with your particular set up, its best to reach out to - we are happy to help take a look at your app and guide you in the right direction here.

This topic was automatically closed after 70 days. New replies are no longer allowed.