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 integrated Stripe payments (the Payment question).
Your customers 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.
You can read more about order forms, and try out our ready-made example typeforms here.
Here’s an example typeform with a shopping basket:
And this is what the Branching and calculations settings look like from the example above:
Warning! Note that the Price variable will not be visible until you add a Payment question to your typeform!
Setting an initial value for the Price variable
Before any questions have been answered, the Price variable can be given an initial value.
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 Calculator 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 for the Payment field:
Let customers choose quantity
Use a Number question to ask your customers for quantity, and then let Branching and calculations work out the total price.
1. Add a Number question, and write your text:
2. Then go to the Logic panel, select Branching and calculations, and set up the Logic like this:
Choose Multiply from the dropdown menu, so that whatever number customers answer, the total price is multiplied by that amount.
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 a coupon code that exactly matches this otherwise the price reduction won’t be applied.
Discount coupons can be set up by using Branching and calculations with a Short text field, like so:
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: