Dynamic price according to quantity

Hi all ! :wave: , thanks in advance for your help.

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
  3. add inputs in your page for product quantity and price
  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
  5. add other conditions

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

@Sart many thanks for your answer.
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 :wink:

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.