Jump to content

[FREE MODULE] Vat checker


Inform-All

Recommended Posts

This module is all you need for intra-Community supply orders.
The module does the following:

  • Automatically checks an VAT number for delivery address
  • Checks if it's a valid VAT number on the official VIES database
  • Gives 0% tax if a VAT is verified

 

761431932_vatoptions.thumb.png.92617c389f74b1e7c2d298f93b1cf869.png

In the settings of the module you fill in your companies Origin Country. Because you can't ship with 0% tax in the same country your company is based.
Every order is checked for their shipping address, NOT the invoice address.

Since the VIES database has some reoccurring offline time, there is an option in how to handle this.
 

Prestashop 1.7 & 8

Download: vatchecker.zip

Got any ideas or updates? 
Feel free to commit on GIT.

Latest update: 24-08-2023

 

Edited by Inform-All
Version update (see edit history)
  • Like 4
  • Thanks 1
Link to comment
Share on other sites

On 8/4/2022 at 8:16 AM, WorDym said:

Looks like it works great so far! I'd just like to ask - am I just blind, or is the phrase "EU VIES server not responding" not available for translation in the administration?

The translation should just be there.

International > Translations > Translation of modules > Vat Checker > your language

Link to comment
Share on other sites

On 8/10/2022 at 7:08 AM, WorDym said:

Yes, I checked the traslation settings, but still can't see the phrase "EU VIES server not responding" over there in either "vatchecker" category or "configure".

image.png

image.png

That is actually really weird. I've tested it in multiple stores, and it always in the list of your screenshot.
Please reinstall the module to check if that helps.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...
	private $euVatFormats = array(
		'AT' => '(AT)?U[0-9]{8}',                              # Austria
		'BE' => '(BE)?0[0-9]{9}',                              # Belgium
		'BG' => '(BG)?[0-9]{9,10}',                            # Bulgaria
		'CY' => '(CY)?[0-9]{8}[A-Z]',                          # Cyprus
		'CZ' => '(CZ)?[0-9]{8,10}',                            # Czech Republic
		'DE' => '(DE)?[0-9]{9}',                               # Germany
		'DK' => '(DK)?[0-9]{8}',                               # Denmark
		'EE' => '(EE)?[0-9]{9}',                               # Estonia
		'GR' => '(EL)?[0-9]{9}',                               # Greece
		'ES' => '(ES)?[A-Z][0-9]{7}(?:[0-9]|[A-Z])',              # Spain
		'FI' => '(FI)?[0-9]{8}',                               # Finland
		'FR' => '(FR)?[0-9A-Z]{2}[0-9]{9}',                    # France
		//'GB' => '(GB)?([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})', # United Kingdom // Brexit!
		'HR' => '(HR)?[0-9]{11}',                              # Croatia
		'HU' => '(HU)?[0-9]{8}',                               # Hungary
		'IE' => '(IE)?[0-9]{7}[A-Z]{1,2}',                     # Ireland
		'IE2' => '(IE)?[0-9][A-Z][0-9]{5}[A-Z]',               # Ireland (2)
		'IT' => '(IT)?[0-9]{11}',                              # Italy
		'LT' => '(LT)?([0-9]{9}|[0-9]{12})',                   # Lithuania
		'LU' => '(LU)?[0-9]{8}',                               # Luxembourg
		'LV' => '(LV)?[0-9]{11}',                              # Latvia
		'MT' => '(MT)?[0-9]{8}',                               # Malta
		'NL' => '(NL)?[0-9]{9}B[0-9]{2}',                      # Netherlands
		'PL' => '(PL)?[0-9]{10}',                              # Poland
		'PT' => '(PT)?[0-9]{9}',                               # Portugal
		'RO' => '(RO)?[0-9]{2,10}',                            # Romania
		'SE' => '(SE)?[0-9]{12}',                              # Sweden
		'SI' => '(SI)?[0-9]{8}',                               # Slovenia
		'SK' => '(SK)?[0-9]{10}',                              # Slovakia
	);

in this list missing XI that is North Ireland and IE2 what is it?

 

Quote

As of 01/01/2021, the VoW service to validate UK (GB) VAT numbers ceased to exist while a new service to validate VAT numbers of businesses operating under the Protocol on Ireland and Northern Ireland appeared. These VAT numbers are starting with the “XI” prefix, which may be found in the “Member State / Northern Ireland” drop down under the new entry “XI-Northern Ireland”. Moreover, any quote of “Member State” is replaced by “Member State / Northern Ireland” and any quote of “MS” is replaced by “MS / XI”. All traders seeking to validate UK (GB) VAT numbers may address their request to the UK Tax Administration.

https://ec.europa.eu/taxation_customs/vies/#/vat-validation

 

XI has same VAT syntax of GB VAT:

(XI)?([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})

 

please avoid the VIES check if the VAT code is in the same country of the Shop.

 

 

Edited by Hart (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

I get the following message when calling up e.g. the shopping cart:

Unknown error in Zeile 719 der Datei /is/htdocs/wp1131087_P0JXD1MK8I/www/shop/modules/vatchecker/vatchecker.php
[8192] ltrim(): Passing null to parameter #1 ($string) of type string is deprecated

Unknown error in Zeile 719 der Datei /is/htdocs/wp1131087_P0JXD1MK8I/www/shop/modules/vatchecker/vatchecker.php
[8192] ltrim(): Passing null to parameter #1 ($string) of type string is deprecated

There have been no changes to the vatchecker. php 

Link to comment
Share on other sites

45 minutes ago, Ritter said:

I get the following message when calling up e.g. the shopping cart:

Unknown error in Zeile 719 der Datei /is/htdocs/wp1131087_P0JXD1MK8I/www/shop/modules/vatchecker/vatchecker.php
[8192] ltrim(): Passing null to parameter #1 ($string) of type string is deprecated

Unknown error in Zeile 719 der Datei /is/htdocs/wp1131087_P0JXD1MK8I/www/shop/modules/vatchecker/vatchecker.php
[8192] ltrim(): Passing null to parameter #1 ($string) of type string is deprecated

There have been no changes to the vatchecker. php 

Has been bug fixed on git.

Link to comment
Share on other sites

  • 3 weeks later...

There is a problem with the VATChecker, the entered gross price suddenly is not accepted and strange behavior when changing the tax rule.
Shop country: Germany, VAT 19%
Uninstalled and reinstalled modules VATChecker, changed vatchecker.php as described on Github.


NCafmRJwTM.thumb.gif.0bad70751846ee702802af3c51258dd6.gif

Link to comment
Share on other sites

On 1/2/2023 at 3:48 PM, Ritter said:

There is a problem with the VATChecker, the entered gross price suddenly is not accepted and strange behavior when changing the tax rule.
Shop country: Germany, VAT 19%
Uninstalled and reinstalled modules VATChecker, changed vatchecker.php as described on Github.

This bug is not related to the vat checker module. The moment you edit your tax incl price it should also edit the tax excl price. You have a different module/edit because your price edit display page is not the Prestashop's default. And besides that the Vatchecker module does not interfere with the product edit pages.

Link to comment
Share on other sites

Thank you for the information.
Prestashop runs with the default theme and settings, only VAT Checker is installed as third-party module.
Presta is present on the European market, so I expected that the different VAT rates would incorporated in PS 8 - this is unfortunately not the case, a thrid-party module is nessesary .

Since it is not due to the VAT checker module, I am opening a new thread with the problem of incorrectly gross prices by saving.

Link to comment
Share on other sites

  • 3 weeks later...

there is something i don't understand here on this code (override) in your module

 

class TaxRulesTaxManager extends TaxRulesTaxManagerCore
{
	/**
	 * Return the tax calculator associated to this address.
	 *
	 * @return TaxCalculator
	 */
	public function getTaxCalculator()
	{
		static $tax_enabled = null;

		if ( isset( $this->tax_calculator ) ) {
			return $this->tax_calculator;
		}

		if ( null === $tax_enabled ) {
			$tax_enabled = Configuration::get( 'PS_TAX' );
		}

		if ( $tax_enabled && $this->address ) {
			/** @var Vatchecker $vatchecker */
			$vatchecker = Module::getInstanceByName('vatchecker');
			if ( $vatchecker && $vatchecker->canOrderWithoutVat( $this->address ) ) {
				// Disable TAX.
				$tax_enabled = false;
			}
		}

		if ( ! $tax_enabled ) {
			return new TaxCalculator( array() );
		}

		return parent::getTaxCalculator();
	}
}

in BO config of the module you can select countries from EU where you can order without VAT (based on the note here)

image.png.3f72829679938b177e8541e887a6f5a5.png

 

Looking inside the code if i disable a country TAXATION is not applied?

Was mopre logical instead that if i dsable Spain flag in config i can order from there only if the customer as a VALID VAT number, because the UX and the message seems to indicate that i will forcing only VAT purcasing not liek i see in the code that is added or not the tax.

There is something i still misunderstanding here?

 

Thanks!

 

 

 

 

Link to comment
Share on other sites

20 hours ago, Hart said:

there is something i don't understand here on this code (override) in your module

 

class TaxRulesTaxManager extends TaxRulesTaxManagerCore
{
	/**
	 * Return the tax calculator associated to this address.
	 *
	 * @return TaxCalculator
	 */
	public function getTaxCalculator()
	{
		static $tax_enabled = null;

		if ( isset( $this->tax_calculator ) ) {
			return $this->tax_calculator;
		}

		if ( null === $tax_enabled ) {
			$tax_enabled = Configuration::get( 'PS_TAX' );
		}

		if ( $tax_enabled && $this->address ) {
			/** @var Vatchecker $vatchecker */
			$vatchecker = Module::getInstanceByName('vatchecker');
			if ( $vatchecker && $vatchecker->canOrderWithoutVat( $this->address ) ) {
				// Disable TAX.
				$tax_enabled = false;
			}
		}

		if ( ! $tax_enabled ) {
			return new TaxCalculator( array() );
		}

		return parent::getTaxCalculator();
	}
}

in BO config of the module you can select countries from EU where you can order without VAT (based on the note here)

image.png.3f72829679938b177e8541e887a6f5a5.png

 

Looking inside the code if i disable a country TAXATION is not applied?

Was mopre logical instead that if i dsable Spain flag in config i can order from there only if the customer as a VALID VAT number, because the UX and the message seems to indicate that i will forcing only VAT purcasing not liek i see in the code that is added or not the tax.

There is something i still misunderstanding here?

 

Thanks!

 

 

 

 

I responded on Git :)

Link to comment
Share on other sites

Hi, I just installed your module on my 1.7.8.8 and it gives me an errror when debug is ON

I'm afraid I can't give you access, because I'm working on localhost

 

PS: thank you for bringing back this feature free of charge, really appreciate it

Firefox_Screenshot_2023-01-30T15-37-50.887Z.png

Link to comment
Share on other sites

1 hour ago, Shin_P said:

Hi, I just installed your module on my 1.7.8.8 and it gives me an errror when debug is ON

I'm afraid I can't give you access, because I'm working on localhost

 

PS: thank you for bringing back this feature free of charge, really appreciate it

Firefox_Screenshot_2023-01-30T15-37-50.887Z.png

What PHP version are you using?
Are you sure you can do a Soap call to the external VIES database?
It's a rather odd error message, please send me a DM if you need more help.

Link to comment
Share on other sites

well it doesnt matter. on production seems to be working: debug is off and that was just a notice right? not an error, so nothing to worry about I hope

i also turned off the "Validation required" option and it works great, I will validate manually

thank you again, coffee is on me this morning 🤪

 

  • Thanks 1
Link to comment
Share on other sites

Hello

I have such a problem using a module in one page checkout.

When I go to the checkout is OK, the VATchecker module works OK.

But when I click the save personal data button, the module freezes, the testing bar does not appear and the error messages VAT number etc. are not displayed.

I have consulted with the manufacturer of The Checkout module and determined that

quotes
"Vatchecker module is using 'token', and it seems that when user account is saved, token changes, but vatchecker script does not update it and uses old token and (I'm guessing) when token is not valid, it doesn't return any value.
See where token is used in vatchecker's JS:
"

 

Anyone have any idea?

 

Regards

Gregory

image.png

Link to comment
Share on other sites

  • 2 weeks later...

Hello, I have downloaded vatchecker-master.zip on github but set-up don't work. Prestashop tell me that something goes wrong and that it doesn't seem like a module.

I'm on 1.7.8.5, did I missed something ?

Thanks.

Link to comment
Share on other sites

13 hours ago, AcidLava said:

Hello, I have downloaded vatchecker-master.zip on github but set-up don't work. Prestashop tell me that something goes wrong and that it doesn't seem like a module.

I'm on 1.7.8.5, did I missed something ?

Thanks.

The zip file needs the exact same name as the module. So rename the zip to vatchecker.zip and you should be fine.
(or download the zip in the first post of this forum topic)

Link to comment
Share on other sites

Thanks for your reply. It doesn't work with the GitHub version even with the right name. I couldn't download the first post .zip yesterday but here it works.

I'd like to know if, as a french shop, there is a way to make it works for french users as they are EU and selected in "Enabled EU countries" ? I still got taxes for them. 

Edited by AcidLava (see edit history)
Link to comment
Share on other sites

2 minutes ago, AcidLava said:

Thanks for your reply. It doesn't work with the GitHub version even with the right name. I couldn't download the first post .zip yesterday but here it works.

I'd like to know if, as a french shop, there is a way to make it works for french users as they are EU and selected in "Enabled EU countries" ? I still got taxes for them. 

Yeah that is possible! In the module you select Origin Country: France. This means, French people will always pay tax. 

Link to comment
Share on other sites

6 minutes ago, AcidLava said:

Shouldn't they don't pay taxes as the others ? Thanks.

Nope. Inside your own country you are now allowed to have a intra-Community supply. Inside your own country you have a add the tax to the invoice.
(No idea why, but this is the European law)

Link to comment
Share on other sites

  • 3 weeks later...

Hello and thank you for this module.

I have been using and it works well, but recently I have issues when I try to modify stocks in my backoffice. I have this message:

 

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND id_country = 74 AND vat_number = ''' at line 3
 

SELECT * FROM ps_vatchecker WHERE id_address = AND id_country = 74 AND vat_number = ''

 

I have to dissable the module to modify stocks or prices and then enable the module again.

Please let me know if there is a solution to this problem.

Link to comment
Share on other sites

2 hours ago, yurda said:

Hello and thank you for this module.

I have been using and it works well, but recently I have issues when I try to modify stocks in my backoffice. I have this message:

 

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND id_country = 74 AND vat_number = ''' at line 3
 

SELECT * FROM ps_vatchecker WHERE id_address = AND id_country = 74 AND vat_number = ''

 

I have to dissable the module to modify stocks or prices and then enable the module again.

Please let me know if there is a solution to this problem.

Hmm.. odd, could you let me know (maybe in debug mode) what file this error is from?

If you are worried about personal data, send a PM.

Link to comment
Share on other sites

  • 2 months later...

Thanks for your module and we use and works perfect for new customer whern are registered with VAT.

But since 1.6 version we have some customers with valid VAT using old native module for that. And when old customers order now in our new version (1.7.8.6) orders show tax again. There are any solution for old customers and remove again taxes? How can do it your module for apply this changes to our old customers?

Regards

Link to comment
Share on other sites

3 hours ago, walala said:

Thanks for your module and we use and works perfect for new customer whern are registered with VAT.

But since 1.6 version we have some customers with valid VAT using old native module for that. And when old customers order now in our new version (1.7.8.6) orders show tax again. There are any solution for old customers and remove again taxes? How can do it your module for apply this changes to our old customers?

Regards


This can be done in the database. But this will be a manual job and probably allot of work. You would have to fill in "ps_vatchecker".
Other option would be to temporarily check if the default address is VAT valid upon login of a customer. But this is also custom job.

Link to comment
Share on other sites

  • 2 weeks later...
23 hours ago, b3dpit said:

I have same problem. When I try to upload the module always (Oops... Upload failed.) appears. Where I can find latest version

This is the latest version (still).
Please enable Prestashop's Debug mode, and share your error.

Link to comment
Share on other sites

3 hours ago, gtnic said:

I have the same problem / oops... what version of php do i need ? and is the module the git zip file ? thanks

The module is in the first post of this forum topic. I just tested it's working on the latest PS version to. So everything above Prestashop 1.6 should work just fine!
Please enable debug mode and share your error. Because i can't really help with more info.

Link to comment
Share on other sites

12 hours ago, gtnic said:

It doesn't work . i already have the VAT . VIES is working , VAT num is ok .. but still having VAT on the invocie

And the order is not from your set origin country? And your overrides are enabled?
(you could send backoffice credentials in a private message, i could check)

 

Link to comment
Share on other sites

  • 1 month later...
20 hours ago, Guillermo80 said:

I install the module and when i tried we have the issue that you can find below.

any idea how resolve?

PRESTASHOP V. 1.7.8.9

PHP V. 7.4.3

image.png

It looks like your debug mode was enabled while the official VIES database was offline.
Please disable debug mode and try again. (and maybe check if your Prestashop hosting has permission to make a external connection to the VIES database)

Link to comment
Share on other sites

1 hour ago, Inform-All said:

It looks like your debug mode was enabled while the official VIES database was offline.
Please disable debug mode and try again. (and maybe check if your Prestashop hosting has permission to make a external connection to the VIES database)

thank,s you are rigth i had the debug mode on

Thank you so much for share us this module.

 

Edited by Guillermo80 (see edit history)
Link to comment
Share on other sites

  • 4 weeks later...

Hello,

Thank you for your hard work and effort in creating this module. I need some help, please.
Unfortunately, I cannot get the module to work. A message is always displayed that the server is unavailable -  "EU VIES server not responding."

I tried replacing the address with a test one in the vatchecker.php file:
https://ec.europa.eu/taxation_customs/vies/checkVatTestService.wsdl
With a test server, all test requests pass (for example, EE100, IT200, IT400), but all VAT numbers are accepted as valid, although IT200 and IT400 should not be accepted as valid numbers. When i try to set a real VAT number while working with a test server, it is displayed as unavailable with the same message (as it should be).

But with the real server https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl it never worked - it’s always “EU VIES server not responding”.

Maybe you have any idea what the reason is? What else should I check or configure to make it work?
Version PrestaShop is  8.1.1

Link to comment
Share on other sites

2 hours ago, AnnikaSMD said:

Hello,

Thank you for your hard work and effort in creating this module. I need some help, please.
Unfortunately, I cannot get the module to work. A message is always displayed that the server is unavailable -  "EU VIES server not responding."

I tried replacing the address with a test one in the vatchecker.php file:
https://ec.europa.eu/taxation_customs/vies/checkVatTestService.wsdl
With a test server, all test requests pass (for example, EE100, IT200, IT400), but all VAT numbers are accepted as valid, although IT200 and IT400 should not be accepted as valid numbers. When i try to set a real VAT number while working with a test server, it is displayed as unavailable with the same message (as it should be).

But with the real server https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl it never worked - it’s always “EU VIES server not responding”.

Maybe you have any idea what the reason is? What else should I check or configure to make it work?
Version PrestaShop is  8.1.1

Please check if your server allows external api calls. And test if your server ip has not been blocked by the VIES database (after to many attemps in 1 minute)

Link to comment
Share on other sites

On 9/15/2023 at 10:00 PM, Inform-All said:

Please check if your server allows external api calls. And test if your server ip has not been blocked by the VIES database (after to many attemps in 1 minute)

Thank you for support.

Finally i have managed to find out the cause of the problem - the SOAP library was not installed in PHP. After installing the library, everything is ok.

 

Link to comment
Share on other sites

Hi there,

I downloaded your module zip file from github and I would be happy to test out your module but on my PS 1.7.8.8 it always shows "Oops... Upload failed" pop-up.

The popup appears both on my test env where I have debug mode enabled and live env where no debug is enabled.

this is the detailed popup output:

image.thumb.png.fe174da77f523576c6d13c5e8dab0853.png

 

I also tried by renaming vatchecker-master.zip to vatchecker.zip but same result.

 

Any help would be appreciated.

Edited by peppezic (see edit history)
Link to comment
Share on other sites

15 hours ago, Inform-All said:

Hi,

You should not only rename the zip. First unzip the file from Github, then rename the folder vatchecker and then zip that.

Or simply download the file from the first post.

I want to congratulate with you.
The module works just great and does what the EU laws require to do (in particular I was impressed about the correct inclusion or exclusion of VAT when you switch between different shipping addresses). I tried several paid modules with no luck.

I have one three questions:
1) The store is correctly showing TAX excluded amounts for products and shipping but the labels on product or checkout pages keep saying TAX included
2) Does the module work with PS 8 ?
3) Does the module use the old Vies WSDL or the new JSON?

Edited by peppezic (see edit history)
Link to comment
Share on other sites

58 minutes ago, peppezic said:

I want to congratulate with you.
The module works just great and does what the EU laws require to do (in particular I was impressed about the correct inclusion or exclusion of VAT when you switch between different shipping addresses). I tried several paid modules with no luck.

I have one three questions:
1) The store is correctly showing TAX excluded amounts for products and shipping but the labels on product or checkout pages keep saying TAX included
2) Does the module work with PS 8 ?
3) Does the module use the old Vies WSDL or the new JSON?

Thanks, good to hear it’s working.

1: it should say correctly, ill get back to you on that.

2: yes.

3: WSDL

Link to comment
Share on other sites

4 hours ago, Inform-All said:

Thanks, good to hear it’s working.

1: it should say correctly, ill get back to you on that.

2: yes.

3: WSDL

I thank you for your interest.
Could the tax included wrong label depend on the default group applied on these VAT free customers? The TAX excluded group (in screenshot "IVA esclusa") have just "Customer" as default group:

image.thumb.png.51817b5298e2bb0ada72ac0a27f866fa.png


Finally I need to ask what's the tax rule group or tax id applied on these VAT free orders.

Thanks again.

 

Edited by peppezic (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...