Product selection (or text) based on answer

I have a form that enters total guests. Based on that answer, I’d like to have the form show (in whatever format) the price for each service:

  1. Drinks: 0-50 guests $100, every additional 25 guests is $50
  2. Food 0-50 guests $100, every additional 25 guests is $50

This will not be a payment form, but I was thinking to make each service a product. I don’t know how the guest count could be used in that setup though. Maybe a calculation instead? But will it be too complicated?

Hey, @beezeyeview.

You’re on the right track there. You can use a product question to represent the quantity of guests for drinks and food as separate products. However, this means they could add the numbers of guests independently. That’s certainly fine, but it looks like you may be after the user simply entering the number of guests and nothing more.

The product setup is more complicated, though, and you may want to do that at some point, so we’ll cover the more complicated case instead since the simpler case is, well, simpler to implement.

You can set your products to a price of 0 and hide product prices in the product question’s appearance tab so users don’t see something like $0.00 on each product.

Let’s step through what a rough example of that might look like.

Setting up the products

  1. Create a product question.
  2. Add your desired products, noting their SKUs (SKUs may be modified).
  3. Toggle can buy more than one product on in the question’s configuration.

Displaying the costs

We need a calculation for this to make use of some conditional logic and arithmetic operations.

drink_qty = {{ product_key.quantities.sku1 }};
food_qty = {{ product_key.quantities.sku2 }};

drink_overflow = if(drink_qty <= 50, 0, drink_qty - 50);
food_overflow = if(food_qty <= 50, 0, food_qty - 50);

drink_additional = roundup(drink_overflow) / 25;
food_additional = roundup(food_overflow) / 25;

drink_total = if(drink_qty <= 50, 100, 100 + drink_additional * 50);
food_total = if(food_qty <= 50, 100, 100 + food_additional * 50);

drink_display = if(drink_qty > 0, "Drinks: $" || drink_total || " for " || drink_qty || " guests\n", "");
food_display = if(food_qty > 0, "Food: $" || food_total || " for " || food_qty || " guests", "");

drink_display || food_display;

where you must replace the following items with your form’s unique data:

  • product_key — your product question’s pre-fill key
  • skuX — the actual SKU for the corresponding product

Finally, you’ll want to make the calculation visible by toggling hide this question off on it. Additionally, you may wish to set visibility logic on it that checks if the product question is answered and then display the result if it is.

Hope this helps!