7

I configured the Enable Automatic Assignment to Customer Group based on VAT number for European customers. It works fine. If a European customer orders and enters a valid VAT number, the VAT is reduced to 0%.

But during checkout the customer doesn't receive feedback on the correctness of the entered VAT number. A lot of customers enter the wrong VAT number and then the VAT is not reduced.

I was expecting feedback to the customer about the validness of the VAT number, but my Magento installation doesn't give this feedback. Is this normal? How can I add this feedback?

  • Means you want your customers to receive this prompt when they enter wrong VAT ID : This VAT number is invalid.. Correct me If I am wrong? – Sweet72 Sep 26 '13 at 13:58
  • @Sweet72 correct – i.amniels Sep 27 '13 at 9:53
  • This is really missing in the core. The extension EU VAT Enhanced replaces the core VAT feature with a more user friendly version where you get this kind of feedback. – Fabian Schmengler Feb 18 '14 at 10:03
  • It is not 100% missing in the core... Its put in a session message but ajax does not refresh the page and opc steps are ajax. Thats the issue. – Toon Van Dooren Nov 7 '14 at 8:20
  • @ToonVanDooren exactly, I'm facing very similar problem in my questions, I'm trying to force it to always add message in oneplace at array $session – versedi Nov 8 '14 at 9:29
1

You can try entering this code in class Mage_Customer_Helper_Data:

protected function _createVatNumberValidationSoapClient($trace = false)
{
    $options = array( 'soap_version'=>SOAP_1_1,
        'exceptions'=>true,
        'trace'=>1,
        'cache_wsdl'=> WSDL_CACHE_NONE,
        'user_agent' => 'Mozilla',
        'proxy_port' => 80);
    return new SoapClient(self::VAT_VALIDATION_WSDL_URL, $options);
}
1

One way of going about this would be to set-up your own extension, which has an action. You can passes the information you need to this action. Then in this action check the vat information and then return a json response, which you can then process on the front end to display the correct message.

You would need to create a small bit of JavaScript that sends the required information from the form to your new controller and shows the response.

The good news is there is already a validate vat helper function and it is used in the admin section when placing an order. This function is Mage_Customer_Helper_Data::checkVatNumber and takes:

  1. A string for the country code,
  2. A string for the vat number,

If you use the following code you will get a gateway response which you can then use to form your Json response in your new controller.

Mage::helper('customer')->checkVatNumber(
    'country_code'
    'vat_number'
);
0

You can manage this by making customer groups for each validation group. So the customer groups would look something like in Magento Guide:

  1. Domestic (normal inside country VAT rate)
  2. EU Vat 0% Validation Success
  3. EU Vat 0% Validation Failed - Invalid ID
  4. EU Vat 0% Validation Failed - Server unavailable

Then you make an IF or SWITCH: case in some of your template files (i.e. for me it's checkout/onepage.phtml) with message adding function which contains specific message for each group. It's not the right way to do that, but simplest.

If you have Validation on Each Transaction then you will also be sure that customer knows which vat rates will be applied, and if he's VIES VAT number has been deactivated - he will notice that and check it with customer support.

  • What's weird for me – when you edit Customer Account by Administrator Panel the Customer will be prompted with default Magento message block on Customer/account page with a message if VAT was verified. Even locale files has string s for that – so why it's working only after editing by administrator? – versedi Sep 30 '14 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.