Item price based on two options chosen by user on item's page


Could you help me with the coding of a total price on an item page based on two sets of parameters?
I know how to define the property of a “total price” element when the item price is static: Quantity * Parentgroup’s Listing’s Price

But the items to be sold actually feature 2 set of options (5 sizes and 2 colors) and each SKU has a diferent price. As a consequence, each item listing includes 10 price fields (5 * 2) in the bubble database.

In adition to the quantity selector, my item page includes two drop down menus (select size and select color) where the user must choose the desired size and color. After he does those 3 selections (quantity, size and color), I would like the “total price” element to be calculated dynamically.

While replying, any link to a manual reference will be much appreciated.


If I’m understanding correctly, each item you’re selling has 10 different prices (depending on size and colour).

In that case, having 10 separate fields in the database (1 for each price) can end up making things very complicated, as you have to include lots of conditionals on your item page and checkout page to calculate the price to be shown (you need to tell the page which field to use to get the price from).

A simpler solution is to have a separate data type called (for example) Item_Price, which would include fields for Item, Size, Colour, and Price.

Then you would have a single field on your Item database called Prices, which would be a list of the (10) item-prices associated with that item.

Then you can use a simple ‘do a search for’ command to search for the item price that matches the dropdown values on the page in order to show the correct price for the item.

That’s the simplest way (in my experience) to handle items with multiple prices (I use that method on my ecommerce site to handle prices in multiple currencies).

Another possible way to do it might be to have a single ‘base price’ for an item, and then include (perhaps in an option set) an amount to add on or take off depending on the size or colour choices.

For example: Size Large might be an extra £5, small might be £3 less etc. That could all be stored in the option set attributes, so when an option is chosen it automatically adds or deducts it to the base price.

Then, in either case, you just multiply it by the quantity to get the total price.

There are probably other ways to do it too, but those are two that I would explore.

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