Working with VAT - Different rates for different countries

Submitted by Leighton Whiting on Mon, 11/21/2011 - 12:57

I often times get asked about how to handle VAT with MoneyScripts modules. Until recently, there hasn't been a good solution for this. In light of this, I've built in support for VAT and country-specific rates into the existing Tax module that comes in MS Core. Here's a tutorial explaining how it works and how to set it up.

First thing we will look at is the new settings in the Admin -> MoneyScripts -> Tax page.

As you can see, there is a new fieldset for Country-Specific tax settings. From here, you can easily add tax settings that are different for any number of countries. Let's add one for France.

Once you click the Add Country button, we will have a new fieldset for France, where we can set the specific settings there:

And that's it, you're done! You can add country specific settings for as many countries as you need. If the country that the user selects doesn't have a specific setting, then it will use the Main setting by default.

Once this is set up, the module will attempt to determine the user's country from a number of different sources, such as past orders or the user's payment profiles which are sometimes saved in gateways (depending on the payment gateway you use). It also will search the profile of the user that is associated in the MS Core settings with the Billing Country field. I will expand more on this later on.

If the module is unable to determine the country for an order and the Country Specific setting is on, then it will add an extra step to the checkout page that will ask the user to select a country before continuing.

As I mentioned before, this new feature supports integration with the Profile module (Profile 2 for Drupal 7). You just need to create a profile field to store the user's country. An example field is shown in this screenshot:

The important thing to note is that the Key for the countries should be the ISO 2 for that country. So for United States, it is US. For France, it is FR. Once that is done, we need to associate this profile field with the Billing Country in the MS Core settings page:

So now when the module is trying to determine the country that is associated with the order, it can use this profile field. This even works during registration if you have that field showing on the registration form:

And you can see that it adds the France tax that we set earlier:

I hope this tutorial helped get you started with VAT! :)

Twitter Feed