For the last two weeks, I’ve been blogging about creating some basic order forms with Formstack. We’ve covered both single item and multi-item forms. This week, I thought I’d go back to a single item form, but this time show how to calculate tax, shipping, and a total, all on the form, instead of on the payment integration page.
We’re going to begin with a single item order form with a t-shirt size select list (with prices added to the option values) and a quantity select list. If you don’t know how to use separate values to associate prices with items, you can read my earlier post on this.
Now, we’re going to add a calculating form field to our order form that will show the total right on our form. To do this, add a short answer field and then click on the button that says “Use Calculation”. For this simple example, the calculation used is T-Shirt Size * Quantity.
Now when we view the form and choose a Large t-shirt and a Quantity of 2, the total automatically changes to $24.00 (as each Large t-shirt costs $12).
Now let’s say we also want to charge $5 shipping per shirt and a tax of 5% of the merchandise total. To find the shipping cost, we’ll first create a hidden short answer field called Shipping Rate and set the default value to $5.
Then we can add another short answer field called Shipping and use a calculation (shipping rate * quantity) to figure out the total shipping cost.
Next, we want to calculate the tax, so we’ll add a hidden short answer field called “Tax Rate” and set the default value to .05.
Now we’ll add another short answer field called “Tax” and use a calculation to figure out how much tax to charge [tax rate * (t-shirt size * quantity)].
Finally, we’ll edit our total calculation to be [t-shirts size * quantity) + shipping + tax)].
On the PayPal Integration page, we only need to set the Price field, which is our Total field. We can leave Quantity, Tax, and Shipping blank as we’ve already added those into our total that we’re passing on to PayPal.
When we look at the completed form in the form builder, it should look like this:
And when we view the form itself, it will automatically calculate shipping, tax and our total as we change the t-shirt size and quantity.