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 form, 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 form on a 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.

Create your form

1. Start with a Welcome Screen.

The Welcome Screen setup window in the form builder interface.

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

A Multiple Choice question block asking respondents to select their pizza size.

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

A Multiple Choice question setup asking respondents for their choice of dough type.

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.

A Multiple Choice question block for choosing toppings with multiple selection turned on.

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.

A Yes or No question block displaying previous choice recalls to confirm customer selections.

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

A Yes or No question configuration prompting the customer if they want extra toppings for a fee.

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.

A Multiple Choice configuration panel showing unlimited selection settings for extra toppings.

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.

A Yes or No verification question utilizing recall text to display selected extra toppings and cost calculations.

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

A Yes or No prompt asking the customer if they would like to add a drink to their order.

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.

A single-select Multiple Choice question panel containing drink menu options.

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

A final review block using multiple data points of recalled information to recap the order total.

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.

A Short Text input field designated for gathering the delivery address.

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

A Phone Number input field explicitly mapped out for collecting contact details.

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

A Short Text block formatted for collecting the customer's name.

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.

A Payment question interface integrated with secure credit card entry forms showing the final price.

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

An Ending Screen designer workspace previewing a delivery confirmation message.

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

How to add logic

1. Go to the Workflow tab, then click the (x) variables icon.

The Workflow tab navigation dashboard highlighting the location of the custom variables element.

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

The custom variables menu in the Typeform builder showing the configuration for drink, size, and toppings variables.

3. Go back to the Workflow tab and click Branching 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.

The Branching panel specifying fixed numerical assignments to the size variable based on distinct answers.

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

An additive mathematical equation row appending the size variable total to the core price variable.

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.

Logic mapping rules specifying target forward or backward question jumps based on a Yes or No answer.

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.

Branching logic logic rules that route the user past additional choices based on skipping actions.

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.

A series of dynamic conditional statements adding a point value sequentially for each pizza topping chosen.

Then, add the toppings variable to price.

The interface configuration panel transferring the compiled toppings sum to the final price calculator.

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.

The logic branching paths controlling back-navigation for order edits versus progress forward to beverage orders.

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.

Branching map split routing users directly to drink lists or bypassing onto the total checkout menu.

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

The mathematical variable logic panel appending select integers to the active drink variable tracker.

Then, add the drink variable to the price variable.

The rule assigning the beverage total variable directly into the core customer balance variable.

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.

The finalized flow overview assigning redirection branches to step 1 for adjustments versus data submission.

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.

Use the preview mode to check if all your logic is working how it should.

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

Was this article helpful?

Have more questions? Submit a request

Tap into our community knowledge

Find answers

Can’t find what you’re looking for?

Contact support