garyconstable
garyconstable

Reputation: 309

Prestashop tax calculation EU customers outside of UK with VAT number

Hello how would I go about overriding the

public function getTaxCalculator();

It's part of the TaxRulesTaxManagerCore class in prestashop?

My boss needs me to give 0% vat to EU customers outside the UK if they have valid VAT Number,

from what I have read I can use the https://github.com/PrestaShop/vatnumber module .

The thing is my zones are setup with each country being a zone - and I do not want to change them all back to being in the EU - this would effect how we have our carrier system setup.

Actually Im thinking I need to alter, ProductCore.php approx line 2598

if ($usetax != false
        && !empty($address_infos['vat_number'])
        && $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY')
        && Configuration::get('VATNUMBER_MANAGEMENT'))
        $usetax = false;

to be something like:

if ( customer has VAT and in EU and not in UK ) $usetax = false;

Maybe thats the better way?

What do people think?

Thanks for your help.

Upvotes: 0

Views: 1172

Answers (1)

Florian Lemaitre
Florian Lemaitre

Reputation: 5748

The vatnumber module does not use zones but country code as you can see:

public static function getPrefixIntracomVAT()
{
    $intracom_array = array(
        'AT'=>'AT', //Austria
        'BE'=>'BE', //Belgium
        'DK'=>'DK', //Denmark
        'FI'=>'FI', //Finland
        'FR'=>'FR', //France
        'FX'=>'FR', //France m�tropolitaine
        'DE'=>'DE', //Germany
        'GR'=>'EL', //Greece
        'IE'=>'IE', //Irland
        'IT'=>'IT', //Italy
        'LU'=>'LU', //Luxembourg
        'NL'=>'NL', //Netherlands
        'PT'=>'PT', //Portugal
        'ES'=>'ES', //Spain
        'SE'=>'SE', //Sweden
        'GB'=>'GB', //United Kingdom
        'CY'=>'CY', //Cyprus
        'EE'=>'EE', //Estonia
        'HU'=>'HU', //Hungary
        'LV'=>'LV', //Latvia
        'LT'=>'LT', //Lithuania
        'MT'=>'MT', //Malta
        'PL'=>'PL', //Poland
        'SK'=>'SK', //Slovakia
        'CZ'=>'CZ', //Czech Republic
        'SI'=>'SI', //Slovenia
        'RO'=>'RO', //Romania
        'BG'=>'BG'  //Bulgaria
    );
    return $intracom_array;
}

public static function isApplicable($id_country)
{
    return (((int)$id_country AND in_array(Country::getIsoById($id_country), self::getPrefixIntracomVAT())) ? 1 : 0);
}

You can use it without problem.

Upvotes: 1

Related Questions