In Magento 1.7 and 1.8 there are 2 "eav_attribute" regarding VAT: 'vat_id' and 'taxvat'. I can display the vat_id on customer address simply from system -> configuration -> customer configuration adding in the address templates:

{{depend vat_id}}VAT ID: {{var vat_id}}{{/depend}}

And it works fine. if I try the same thing with the 'taxvat' field

{{depend taxvat}}CF: {{var taxvat}}{{/depend}}

it doesn't work...

I think that it depends from the file


so I create a custom module and added my config.xml, then I tried to edit the configuration to make the taxvat field like the vat_id field, but still it doesn't work. What's the best practice to display this builtin field in the address?


The reason that the taxvat is not working is because there is not attribute taxvat saved as part of the address. You can see this by looking into the table eav_attribute and filter on entity_type_id where the id is 2 (note that this is in the default data the address id)

You can either make a new attribute on the address, but that is a lot of work. What you could do instead is to look at the event customer_address_format here you can add items to the address object before rendering so you should be able to add the taxvat from the customer to the address.


Here is the code to add the vat_id (taxvat) as variable in address :


<?xml version="1.0"?>



class ClientName_Sales_Model_Observer

     * Add vat_id in address
    public function addAdditionalDataToAddress(Varien_Event_Observer $observer)
        $event = $observer->getEvent();
        $address = $event['address'];
        $orderData = $address->getOrder()->getData();
                    'vat_id' => $orderData['customer_taxvat'],

Then you can use this in your address template :

{{depend vat_id}}VAT ID: {{var vat_id}}{{/depend}} 

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.