Herzlich willkommen

Compatibility with BSS B2B Registration

Created at: 1 Jun 2018 | Updated at: 12 Jul 2023

To show the VAT number field with validation possibility at the B2B registration page, add the following code where you want the field to be displayed (for example below the country field):

<div data-bind="scope: 'vat-id-input'" id="vat_number_container" class="fields"> <!-- ko template: getTemplate() --><!-- /ko --> </div>

At the bottom of the template file, include this code to initialize the field and it's options:

<script type="text/x-magento-init"> { "#vat_number_container": { "Magento_Ui/js/core/app": { "components": { "vat-id-input":{ "component":"uiComponent", "children": { "vat_id": { "component": "Geissweb_Euvat/js/form/element/vat-number-front", "config": { "allowedCountries": ["AT","BE","BG","HR","CY","CZ","DK","EE", "FI","FR","DE","GR","HU","IE","IT","LV","LT", "LU","MT","NL","PL","PT","RO","SK","SI","ES","SE","GB"], "enableAjaxValidation": true, "handle": "customer_account_create", "debug": false, "template": "Geissweb_Euvat\/vatfield", "elementTmpl": "Geissweb_Euvat\/vat-input", "vatFrontendVisibility": true, "tooltip": {"description":"My Tooltip!"} }, "validation_registration": {"":true} } } } } } } } </script>

With this method, the configuration of the field is hardcoded. Any changes to the admin config won't be reflected here, you need to change the config manually if you want to modify the behavior.

For example you might want to make the field to require a validated VAT number if there is a value in the field. You would change the "validation_registration" option as following then:

"validation_registration":{"valid-vat-if-specified":true}

For further customization please refer to our support.

Categories: EU VAT Enhanced (M2)