Create an order form and shopping basket with branching and calculations

You can design your own custom shopping experience with Typeform by combining Calculations and the Payment question with Stripe or PayPal.

Your customers can make their selections, the ‘Price’ variable increases or decreases depending on their selections, and the Payment question is automatically ready with the right price at checkout.

Try a ready-made order form template.

Here’s an example order form form with a shopping basket:

And this is what the Calculations logic settings look like from the example above. The question asks which dessert they would like to order and then a different price is added to the price variable depending on what the respondents selects.

HC_Warning_ilu_cropped.png
Warning! Note that the Price variable will not be visible until you add a Payment question to your form!

Setting an initial value for the Price variable

Before any questions have been answered, the Price variable can be given an initial value. To use the Price variable, you must use the Payment question type either with Stripe or PayPal.

The initial value would be 0 (zero) if you want to do a straightforward shopping cart which adds up the total price for all items selected. But you can also use calculations to apply a discount, for example, decreasing the price from its initial value. You could also use this option to apply a delivery charge, if you like.

You can set the initial value for the Price variable on the Question settings screen on the Payment question.

Set up calculations

Use a Number question to ask your customers for quantity, and then let calculations work out the total price.

1. Add a Number question, and write your question.

2025-06-27_12-56-15.png

2. Click + next to Logic in the right side panel of the Number question. 

Then click Calculations.

3. Then create the rule:

Multiply price by Number question

Choose Multiply from the dropdown menu, so that whatever number customers answer, the total price is multiplied by that amount. Click Save when you're done.

Discount coupons

You can add a discount by subtracting whole numbers from the price variable. You can set up coupon code calculations on a Short text or Long text question.

Let’s say you’re selling an eBook which retails for $9, and you want to enable the coupon code “earlybird” which will reduce the price by $2 to $7. Once set up, people need to enter the exact coupon code, otherwise the price reduction won’t be applied.

You can create a Calculation rule:

Subtract 2 from the price variable when What is your discount code question is equal to earlybird

You can also create coupons with percentage discounts by multiplying the price variable. For example, to give a 10% discount, you have to multiple the price by 0.9, for a 20% discount by 0.8, and so on.

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