# Dynamic price according to quantity

I have a multi step form calculation cost. User selects from multi repeating groups the product they want. On the last step, they are able to fill out a quantity for each item they selected (auto binding input on a repeating group).

Iâ€™d like on a final step to update the price of the products they selected according to the quantity they filled out on the input.

Each product has a global price and the price decreases according to quantity. Letâ€™s say :

Product 1, when QTY is < 10 = \$23

Product 1, when QTY is > 10 = \$18

Product 1, when QTY is > 40 = \$10

Quantity can be a different type according to the product selected : meters, unit, length, square meters â€¦ But the final price is always QTY * product selected price.

Right now, i have theses data types :

PRODUCTS

• name (name of the product)

• price (the original price)

SELECTED PRODUCT

• product(product)

• Quantity(number)

CART

• List of products

• list of selected product

For the cart, i display all the product selected from different categories.

Iâ€™m not sure how to do this one ;( Should I create another data type ? If yes, of am i supposed to set up this one ? Or should I work with back end api to work on a list and update the price ?

As per your information : each product can have +/- 6 price variation, i have +/- 20 categories and +/- 400 products. THANK you if you can help or send me any good ressource â€¦

Hey @Alter345 ,

here is what you can do to create a better database:

1. create an option set for product catagory and add diff categories of product in the option set
2. create a data type â€śProductsâ€ť, add fields e.g name, price, quantity, product category and give them the suitable field type
4. in input price put a condition for its placeholder or initial content that
when input quantity <10
place holder = 23
NOTE: donâ€™t forget to set your input quantityâ€™s content format as integer and input priceâ€™s content format as currency

and you will get your solution.
always try to make your database as smooth and simple as possible.

Thing is, iâ€™m displaying a list of product selected by the user in a repeating group.
Each product on the repeating group has different price logic, so i cannot create a â€śglobalâ€ť condition on the repeating group (on the input for adding desired quantity)
For exemple :
Product 1, price = 10
if quantity is 10 then price is 8
if quantity is 8 then price is 12
if quantity is 12 then price is 14

Product 2, price = 12
if quantity is 10 then price is 43
if quantity is 8 then price is 36

etc â€¦ for +/- 300 products â€¦

Thanks again !

ohk,â€¦
its a complex workflow.
the idea i am getting now is to do it manually without using RG.
if i will get any better idea i will let you know.

Maybe with â€śnumber rangeâ€ť data type â€¦ I ll check

I would take the auto-binding off the Quantity input and instead use a â€śWhen an Inputâ€™s value is changedâ€ť event instead (click to create a new event and itâ€™s the second option in Elements). Link it to the Quantity input that you have. The first step is to â€śMake changes toâ€ť â€¦ the quantity field (presumably on your Cart list data type), then add actions to calculate the price that you want based on the quantity and then do another â€śMake changes toâ€ť to the price field.

If each item or category of items have their own rules regarding the quantity ranges that determine the unit price, youâ€™re probably gonna need a pricing table (type) that you run a query on (do a search for â€¦) to return you correct price. Eg

PRICE_BREAK
Item
Low Quantity
High Quantity
Price

You can then run a search for the :first item that returns for the item where the quantity greater than or equal to the Low Quantity and is less than or equal to the High Quantity and that will get you the price.

Hope that helps.

I will check thank you very much for your help !

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