Herzlich willkommen

Adding the VAT ID Field

So that customers can enter a VAT ID, the address-based vat_id field must be enabled and – depending on the theme – made visible in the template.

Enable the field in the Magento configuration

First check whether the field is enabled in the Magento configuration under System → Configuration → Customer Configuration → Create New Account Options → Show VAT Number on Frontend. For background on the correct field, see Using the VAT number field correctly.

Add the field to the template

If the field is enabled but does not appear, it is missing from the respective template. Add it using the following snippets.

Customer registration

<?php if (Mage::helper('customer/address')->isVatAttributeVisible()) : ?>
    <label for="vat_id"><?php echo $this->__('VAT Number') ?></label>
    <div class="input-box">
        <input type="text" name="vat_id" value="" title="<?php echo $this->__('VAT Number') ?>" id="vat_id" class="input-text <?php echo Mage::helper('customer/address')->getAttributeValidationClass('vat_id') ?>">
    </div>
<?php endif; ?>

Shopping cart page

<?php if (Mage::helper('customer/address')->isVatAttributeVisible()) : ?>
    <?php $vatId = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getVatId(); ?>
    <label for="vat_id"><?php echo $this->__('VAT Number') ?></label>
    <div class="input-box">
        <input type="text" name="vat_id" value="<?php echo $this->escapeHtml($vatId) ?>" title="<?php echo $this->__('VAT Number') ?>" id="vat_id" class="input-text <?php echo Mage::helper('customer/address')->getAttributeValidationClass('vat_id') ?>">
    </div>
<?php endif; ?>

Checkout – billing address

<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
    <label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
    <div class="input-box">
        <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
    </div>
<?php endif; ?>

Checkout – shipping address

<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
    <label for="shipping:vat_id"><?php echo $this->__('VAT Number'); ?></label>
    <div class="input-box">
        <input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
    </div>
<?php endif; ?>

Show the VAT ID in transactional emails

You can print the VAT ID anywhere in a transactional email via the order's address:

{{var order.getShippingAddress().getVatId()}}