The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Remove tax for EU B2B customer who provides their vat registered number

timconsidinetimconsidine Member
in Help edited January 2014
New user assessing Foxycart and wanting to go live
But confused - I have read docs and searched forums.
I haven't seen anyone discuss about business clients in EU who provide their VAT number.
No field to store it in and no facility to remove tax if valid number specified (which leads on to vat number verification)
This could be a big issue as the store sells to professional clients, many of whom are vat registered.

Have I missed something ?

  • fc_adamfc_adam FoxyCart Team

    Unfortunately we don't have a solid support for Europe VAT taxes. Taxes currently don't really support inclusive taxes like VAT or GST.

    There are work arounds to get it working, but they require some additional programming to achieve and may not be perfect for all situations. Essentially you would need to have 2 versions of each category - one that is taxed and one that isn't. Then if the customer provides their details to prove their tax exempt, you would update the products in the cart to make them belong to the category that is not taxed. Not perfect, but it can work.
  • ok, thank you.
    Not sure this is about inclusive taxes, but i take your point.
    So, as a new user, do you have a pointer or advice about how I switch categories based on additional checkout field ? Is there a snippet or some examples ?
  • timconsidinetimconsidine Member
    edited January 2014
    OK, so thanks to some invaluable assistance from fc_adam (thanks again, Adam), here is my solution to this issue, presented in 2 comments.

    As a reminder, it is essential for one of my merchant scenarios to allow business users in Europe to buy from my UK store without having to pay VAT if they provide their VAT number from their EU member state. This is rapidly becoming expected functionality for business users in UK and EU.

    As I am not a developer, I wasn't confident in implementing a switch of product categories to change tax status. So I devised this approach to make use of Foxycart functionality with minimal coding.

    Credits are due to which is where I took the VAT number validation routine. Please note this approach is to validate the structure of the number submitted for the country. It does NOT do a look-up of the main EU database at I will look at doing this later as an enhancement as there is an API but no time to study or implement for now.

    Any improvements gratefully received.

    NB : this depends on Foxycart's standard logic of assessing tax based on shipping destination. There is currently an unsupported scenario of a UK purchaser with UK billing but EU shipping. My understanding is that in this case VAT does not need to be charged, but the code does not allow VAT removal for a UK purchaser. This should be coded for as an exception, but it is rare and I do not have time for it currently. So it is a limitation on usage, but rare occurrence in my experience.

    Due to limitations on length of discussion postings, this is submitted in 2 sections with an external link, and may be more "digestible" that way.
  • timconsidinetimconsidine Member
    edited January 2014
    1. Create a coupon.
    Can be named as you wish - I have done this :

    Coupon Name: Void VAT for EU-VAT registered business
    Coupon Type: Discount by a percentage based on the price in this category
    Discount: 1-20
    Start Date: N/A
    End Date: N/A
    Number Allowed: Unlimited
    Number Left: Unlimited
    Combinable? Yes
    Taxable? Yes
    Exclude Category Discounts? No
    Exclude Line Item Discounts? No
    Valid for categories: All Categories
    Coupon Codes: EU-VAT

    I then added some words to the Cart template after the ^^cart^^ line and before the closing </body>

    <h5 style="font-family: verdana; color:#d33c35"> Registered for VAT in the EU ?</h5>
    <p style="font-family: verdana; font-size:12px">We do not need to charge VAT if you are a VAT-registered business in another EU member state (not UK), and enter your VAT number on the checkout page.  To remove VAT from your order, click the <a href="#" onclick="fc_AddCoupon(); this.blur(); return false;">"add a coupon"</a> link and use the coupon EU-VAT.

    N.B. The following code will search for a unique part of the coupon name (not coupon code), so make sure the relevant words are used. In this case I have targeted "EU-VAT" in coupon name and search.

    2. Modify checkout template
    This section is long, so the content has been posted at the following link
    Go to
    Follow the instructions in Step 2 there.

    3. Review for your country.
    The above is designed for a UK merchant.
    If you are based in another EU state, you will probably want to change these parts :

    - in the displayed instructions
    <label style="display: none;" class="fc_error" id="UKVATerror" for="UKVATerror">Cannot remove VAT for UK order or shipment</label>

    - within the function EUVATApply()
    if (document.getElementById('shipping_country').value == "") {
    if (document.getElementById('customer_country').value == "GB") {
    if (document.getElementById('shipping_country').value == "GB") {

    - within the function checkVATNumber (toCheck)
    follow the instructions inserted as comments at start of function to modify the defCCode values

    4. Add a tax for each EU country.
    I have used these (you can look up the country name using Foxycart checkout based on 1st 2 letters of code)

    5. Test, test, test .... test !
    This is provided without responsibility or liability.
    I have used and modified code snippets from here, so thank you to all who provided those.
    Adam has provided great advice.
    I have used freely available vat logic.
    But only you know your scenario, so test, test, test.

    Hope this helps someone.
    I am liking Foxycart greatly and hope it can satisfy remaining functionality scenarios.

    Best wishes


  • Have Foxycart come up with a built in solution for this problem yet?
    Did you try getting it validated against the database?
    New user looking as using Foxycart as a solution with Craft CMS with this required functionality.
  • fc_adamfc_adam FoxyCart Team

    Thanks for asking - yes we have. We support automatic EU tax lookup, and you can enable a tax ID field to allow the customer to note that they are tax free. Currently that tax ID field is not validated - but it does allow companies to note their tax exemption status on the checkout. More information at
Sign In or Register to comment.