How to Add Tax with a WordPress Form (Sales or VAT!)

Are you a small business or entrepreneur looking to use a form to sell your product or service? Your forms are perfect for small volume sales, but collecting sales or VAT tax with a WordPress form can look a little tricky.

If you’re only dealing with a flat sales tax, you may have considered just lumping tax into the price of the product. That’s a far less than ideal remedy, as it makes your prices look artificially inflated.

You may have looked to your payment gateway and discovered that if they handle tax at all, it’s post-sale. That’s also a problem as the full purchase price will differ from the price at the point of sale.

If you’re needing to collect VAT, the added complication of collecting variable levels of tax can be even more of an obstacle.

Fortunately, collecting sales or VAT tax with a WordPress form is easy to set up. It just takes a little know-how!

These 3 steps will have you collecting sales or VAT tax with just a few minutes of setup

This is a very simple process that will only take a few minutes to set up. Each step is broken down in detail below, but in a nutshell all you need to do is:

  1. Get the right fields in palce
  2. Create calculations to calculate tax
  3. Set your fields to display the subtotal/tax/total amounts

If you’re collecting VAT tax with a WordPress form there are only a few tweaks that you’ll need to make along the way. They’re clearly stated below!

Step 1: Get the right fields in place

In this example we’ll build a form that handles 2 products, displays a pre-tax subtotal, the amount of tax charged, and finally a total. Here’s an image and a breakdown of the fields we’re using:

  • Product 1 and Product 2: Basic product fields
  • Subtotal, Tax, and Total: HTML fields, for displaying values

VAT only:

If you’re collecting VAT tax with a WordPress form, you’ll need one additional field: a Multi-Select or a Radio List with a list option from every VAT state that you’ll be selling to. The customer will need to use this field to indicate where they’re purchasing from.

Enter each location as a list option, and set the calc value to the VAT rate for that state. Use decimal notation as opposed to the actual percent; for example, .19 as opposed to 19%:

multi-select list set up to collect tex with a wordpress form

Step 2: Create calculations to calculate tax

Click on the Advanced tab of your form and select Calculations. We’ll need to create 3: one to get the subtotal, one to get the amount of tax, and one to get the grand total. Again, here’s an image + breakdown for this example:

calculations to collect tax with a wordpress form

For each of these equations, we’re simply inserting the relevant fields via merge tag. To access the available merge tags for your form, click the ‘sandwich’ icon inside the equation box on the right.

  • Subtotal: This calculation adds the two product fields together. Adjust as needed for the number of items you’re selling.
  • Tax Value: This calculation multiplies the Subtotal calculation by the tax rate. If you’re doing a fixed sales tax, you can just enter the tax rate as decimal notation (8% in this example would be .08). If you’re doing VAT, use the merge tag for the list you set up in Step 1.
  • Total: This calculation adds the Subtotal calculation plus the Tax Value calculation to display the grand total.

Step 3: Set your fields to display the calculations you just created

We used HTML fields for the Subtotal, Tax, and Total fields in Step 1. That was specifically intentional so that we can display those values now. That’s no more difficult that a short bit of text and a merge tag.

Here’s the Tax field as an example:

field set up to display tax value

“Tax:” is simple text to display on the front end for the user. Follow that up with the merge tag for the corresponding calculation. In this case, our Tax Value calculation. Do the same for Subtotal and Total in turn. Here’s the result:

**The form in the above image has had some basic layout changes made via the Layout and Styles add-on.

With these 3 steps and ~5 minute out of your day, you can now add tax with a WordPress form!

Wether it’s a fixed sales tax or variable tax like VAT you need, you’ve got it. Following the steps above, you now have a working commerce form that handles tax for you. No more finding flaky ways to apply it after the fact, or artificially inflating your prices to account for tax!

Comments are below! Are there other aspects of a commerce form that you’re struggling with and would like to see a write-up on?

Need to calculate sales tax in a form? No problem. VAT tax? It's a breeze too. Find out how!Click To Tweet