Jump to content

EU VAT Add-On behaviour: doesn't update total amount on checkout


Recommended Posts

hi everyone,

 

there is just a tiny thing that bothers me:

when doing the EU VAT checkout, i am entering the VAT # on the checkout page where all the personal information is collected, but the total sum still includes the tax and it won't subtract the tax until i click "purchase now" button which then shows the preview of the order.

 

unfortunately, a typical customer who enters a VAT# in order to not pay the VAT won't hit "purchase now" as long as the total amount is including the tax.

 

i wanted to fix this in modules/addons/eu_vat but unfortunately all the code is ionCube encoded. so basically i'm not sure how i could fix that behaviour.

 

any suggestions?

 

p.s. i'm rather new to WHMCS but i've got several years of experience as a developer and i have to say, WHMCS is by far the best and most fun system to work with that i have seen. excellent work, guys!

Link to comment
Share on other sites

  • WHMCS Technical Analyst

Hi Franky,

 

Welcome to WHMCS, and thank you for your kind words. We appreciate it!

 

Our team is currently working on some improvements to the EU VAT support in the product and so I'll be sure to pass along your feedback regarding having the VAT update in real-time once a valid VAT # has been provided.

 

-Eddy

Link to comment
Share on other sites

thank you very much!

 

just for completeness: i'm using the "six" template together with the "standard_cart".

 

And, here is a regex for validating the EU VAT # custom field. In case someone else is also searching for it:

 

/^((AT)?U[0-9]{8}|(BE)?0[0-9]{9}|(BG)?[0-9]{9,10}|(CY)?[0-9]{8}L|(CZ)?[0-9]{8,10}|(DE)?[0-9]{9}|(DK)?[0-9]{8}|(EE)?[0-9]{9}|(EL|GR)?[0-9]{9}|(ES)?[0-9A-Z][0-9]{7}[0-9A-Z]|(FI)?[0-9]{8}|(FR)?[0-9A-Z]{2}[0-9]{9}|(GB)?([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})|(HU)?[0-9]{8}|(IE)?[0-9]S[0-9]{5}L|(IT)?[0-9]{11}|(LT)?([0-9]{9}|[0-9]{12})|(LU)?[0-9]{8}|(LV)?[0-9]{11}|(MT)?[0-9]{8}|(NL)?[0-9]{9}B[0-9]{2}|(PL)?[0-9]{10}|(PT)?[0-9]{9}|(RO)?[0-9]{2,10}|(SE)?[0-9]{12}|(SI)?[0-9]{8}|(SK)?[0-9]{10})$/

Link to comment
Share on other sites

I am going online tomorrow, for anyone who is also desperate and needs a quick workaround, here it is:

 

This will make it work. It's far from perfect, but it's the best i could come up without touching the encrypted PHP code from the WHMCS module:

 

in templates/orderforms/standard_cart replace:

 

{$LANG.ordertotalduetoday}:   <strong>{$total}</strong>

 

with

 

{$LANG.ordertotalduetoday}:   <strong>

 

<!-- VAT/UID Check: -->

{foreach $customfields as $customfield}

{if $customfield.name eq "UID"}

{if empty($customfield.value)}

{$total} (including {$taxrate}% {$taxname}

{else}

{if $errormessage|strstr:"UID" || $errormessage|strstr:"VAT"}

{$total} including {$taxrate}% {$taxname} (invalid VAT/UID specified!)

{else}

{$subtotal} (no taxes, valid VAT/UID specified!)

{/if}

{/if}

{if $errormessage|strstr:"UID"}

(including tax, invalid VAT/UID!)

{/if}

{/if}

{/foreach}

</strong>

 

So it will show the correct price including or excluding VAT once the form was submitted. To force update (without submitting the final order!) you can add a button to force VAT/UID validation, this is after {$customfield.input} (approx. line 227 in the same template as above):

 

{if $customfield.name eq "UID"}

<button type="submit" id="btnCompleteOrder" class="btn btn-primary btn-lg" onclick="document.getElementById('accepttos').checked=false;this.value='Bitte warten...'">

Check {$customfield.name}

</button>

{/if}

 

 

This is NOT a clean ant NOT good solution. It's just a "help yourself" improvement until the official solution is there.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated