I need to add the taxvat id into the order confirmation E-Mail but I can´t get it to work. There is a block {{var order.getBillingAddress().format('html')}} and I´ve added <br/>{{var customer.taxvat}} right after that.

I would need this taxvat id below the adress or somewhere in it but it doesnt seem to work this way. I´ve made sure there is an id registered within this account but I just can´t fetch it.

Someone in here who has done this before?

6 Answers 6


When an order is placed, a number of fields are copied from the quote and customer into the order. One of those fields comes from the quote, and is the associated customer's tax VAT ID.

To the point, you should be able to use this in your transactional e-mail templates:

{{var order.customer_taxvat}}

And that will give you what you're looking for. For some technical details, see app/code/core/Mage/Sales/etc/config.xml, ~line 186 and also some details about how fieldset copying works across entities:


  • Thanks! So all fieldsets in there should be available from order.xxx. Is it possible to add an if into E-Mail templates like if(var order.customer_taxvat!=='')?
    – Jan
    Commented Feb 25, 2015 at 15:57
  • Conditionals are supported: excellencemagentoblog.com/blog/2011/11/25/… Unfortunately conditional operators (<=, <, !=, etc) are not supported. However, the condition you name above should loosely be equivalent to {{if order.customer_taxvat}} because the directive filter that processes that bit will translate to the PHP code if($order->getCustomerTaxVat()) return true which, if it is not empty, will return true. Commented Feb 25, 2015 at 16:30

This solution worked fine for me:
{{var billingaddress.vat_id}}


If you want to show the VAT to any address that has the VAT field filled, either in the admin area in the Order View page or in transactional emails, then the simplest way is to add something like this:

{{depend vat_id}}
  <br/>VAT: {{var vat_id}}

At the bottom of the textarea in:

System -> Configuration -> Customers -> Customer Configuration -> Address Templates -> HTML


What I´ve done so far:
USt-IdNr.:{{if order.customer_taxvat}} {{var order.customer_taxvat}}{{else}} k.A.{{/if}}
It´s working for a regular order confirmation now.

But I´ve got the next mysterious problem:
-if a registered user is ordering everything is working as expected.
-if a unregistered user is ordering the vat number cant be displayed / order.customer_taxvat=false.

Do I have to call it on another way or could that be a bug?


This one works for me:

{{depend order.getCustomerTaxvat()}}
   USt-IdNr.: {{var order.getCustomerTaxvat()}}

I used below code to get the customer tax/vat. It is properly working for me.

Vat Number: {{var order.getCustomerTaxvat()}}

in sales order email template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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