Custom Price Based on User Inputs

I am selling theme park tickets to a number of attractions and am looking to display the total price based on the selections the customer makes, for example, see below, each field will be a dropdown;

Choose Year of Travel (2018, 2019)
Choose Ticket Type (7 Day Ticket, 14 Day Ticket, 21 Day Ticket)
Adult Tickets (1-10)
Child Tickets (1-10)

Each ticket type will have a different adult and child price for 2018 & 2019
This then needs to be multiplied by how many adult and child tickets are selected.

I hope this make sense, if not then let me know and i will do my best to explain it.

Hi,
You can save the price for each ticket in a database, then, you can get the data about the selected ticket using query , afterwards display the total price with simple calculation, for example:

let ticketType = $w("#dropdown1").value;
let year = $w("#dropdown2").value;
  wixData.query("myCollection")
  .eq("type", ticketType)
  .eq("year",year)
  .find()
  .then( (results) => {
    let adultPrice = results.items[0].adultPrice;
    let childPrice = results.items[0].childPrice;
    let totalPrice = $w("#adultnumberdropdown").value * adultPrice + $w("#childnumberdropdown").value * childPrice;
    $w("#totalPrice") = totalPrice;  
  } 
  .catch( (err) => {
    let errorMsg = err;
  } );

Good luck :slight_smile:

Thanks for this, i am getting a parsing error for the total price. Not sure why, or how the database for the prices needs to be set up for this to work?