Signup
 

Get the most out of Logic, variables, and scores (while ordering pizza!)

Branching and calculation, variables, and scores let you use the whole arsenal of the Logic tools that Typeform has to offer. You can add multiple custom variables to your typeform, use recall information, skip irrelevant questions and calculate scores and price. Read on to find out how.

Note: Logic isn't available on our mobile builder just yet. Edit your typeform on desktop to get the full power of Logic!

In this example we’ll show you how to create a pizza order form that lets people choose the size of their pizza, add extra toppings, and optionally select a drink. Then we’ll let Branching and calculations do the math, and add up everything in a neat Payment question.

First, add your questions to your typeform.

1. Start with a Welcome Screen.

Screen_Shot_2021-06-08_at_11.29.03_AM.png

2. Next, let’s ask people what size pizza they’d like with a Multiple Choice question.

Screen_Shot_2021-06-08_at_11.30.08_AM.png

3. Then we’ll ask people what kind of dough they’d like with another Multiple Choice question.

Screen_Shot_2021-06-08_at_11.30.53_AM.png

4. Now it’s time to choose topping with the help of another Multiple Choice question. You can enable Multiple selection in question settings to let people choose up to 3 toppings.

Screen_Shot_2021-06-08_at_11.31.44_AM.png

5. Let’s add a Yes/No question to ask people to confirm their choices. You can type @ to use Recall information and show them what they selected.

Screen_Shot_2021-06-08_at_11.32.34_AM.png

6. Add another Yes/No question to ask people whether they want extra toppings for an additional fee.

Screen_Shot_2021-06-08_at_11.34.14_AM.png

7. Now people can pick their additional toppings from a Multiple Choice question with Multiple selection enabled, where they can choose as many additional toppings as they want.

Screen_Shot_2021-06-08_at_11.35.22_AM.png

8. Next we’ll use a Yes/No question to ask people to confirm their selection, and show them which toppings they chose and how much it will cost them with Recall information.

Screen_Shot_2021-06-08_at_11.36.12_AM.png

9. Next, we’ll ask people if they want to order a drink for an additional fee with a Yes/No question.

Screen_Shot_2021-06-08_at_11.36.48_AM.png

10. If they say Yes, they can choose what they want from the drink menu with a Multiple Choice question, where they can only select one option.

Screen_Shot_2021-06-08_at_11.37.33_AM.png

11. Let’s add a final Yes/No question where people can review their order with Recall information.

Screen_Shot_2021-06-08_at_11.38.30_AM.png

HC_BobRoss_ilu_cropped.png
Tip! Use Question Groups to easily duplicate sets of related questions. That way, you can give respondents the option to add multiple pizzas to their order.

12. Now we can ask people for their delivery address with a Short Text question.

Screen_Shot_2021-06-08_at_11.39.21_AM.png

13. Then we’ll ask for their number with a Phone Number question.

Screen_Shot_2021-06-08_at_11.40.24_AM.png

14. We’ll ask for their name with another Short Text question.

Screen_Shot_2021-06-08_at_11.42.11_AM.png

15. Finally we’ll create a Payment question where people can provide their credit card details and pay for their order. We’ll also show them the final price with Recall information.

Screen_Shot_2021-06-08_at_11.42.54_AM.png

16. Now when people hit Submit, they’ll see an Ending screen letting them know that their order is on its way.

Screen_Shot_2021-06-08_at_11.43.40_AM.png

Now that we’ve asked everything, it’s time to use the magic of Logic!

1. Go to the Logic panel, click Personalize with data then Variables:

Screenshot_2023-01-04_at_09.19.59.png

2. Use + Add variable to create your own, then hit Save when you’re ready. For this typeform, we’ll add a custom drink, size and toppings variable.

pizza12.png

3. Go back to the Logic tab and click Branching and calculations to change your variable values based on how customers order their pizzas. First, let’s add values to the size variable depending on which size of pizza the customer chooses, like so.

pizza1.png

4. Then add the size variable to the final price:

pizza2.png

5. Add Logic to your Yes/No question on toppings, where people can confirm which toppings they'd like. Take people back to the previous question if they say No and to the next question if they say Yes.

pizza3.png

6. Then add Logic to the Yes/No question on additional toppings to take people to the additional topping selection, or let them skip it if they don’t want additional toppings.

pizza4.png

7. Repeat the process for size with the toppings variable - for every topping chosen, add 1 to the variable. The difference here is that each topping costs the same, but people can choose multiple toppings which will then be added to the final price.

pizza5.png

Then, add the toppings variable to price.

pizza6.png

8. Add Logic to the Yes/No question confirming the additional toppings. Customers who answer No will go back to the previous question and can change their topping choices, while customers who answer Yes will move on to the drink ordering question.

pizza7.png

9. Add Logic to the Yes/No question asking about adding a drink - customers who say they want a drink will see the drink selection question, and customers who don't want to add a drink can review their final order.

pizza8.png

10. On the drink selection question, use Logic to add 1 to the drink variable for any drink chosen.

pizza9.png

Then, add the drink variable to the price variable.

pizza10.png

11. Add your final Logic to the Yes/No question where customers can confirm their order. This way when people see a mistake in their order details, they’ll be taken back to the first question, and if they confirm their order, they’ll be asked to add their contact details.

pizza11.png

That’s it, your order form is ready! You better start heating up the oven and chopping your ingredients to bake all that delicious pizza.

If you feel like one pizza is not enough, you can check out our article about how to multiply by quantity selected here.

Tap into our community knowledge