Address validation for Magento 2 with Melissa Data

Akitogo Team, 27 Jul 2020

Some time ago we evaluated several address validation services for Magento, we found the results from Melissa Data more accurate than others especially for international addresses with a focus on Germany, other European countries and the US.

The reason why to use address validation before shipping is pretty straightforward it simply reduces the amount of failed deliveries notably. If you google for it you will find that up to 20 percent of entered addresses in online shops have some kind of error.

The missing extension

For a recent migration project from Magento 1.9 to 2.3 we found that there was not publicly available extension for current Magento. That was the main reason why we made our work available under a MIT license on Github.

Before using the extension make sure that you have a valid API key, which can be obtained either from https://www.melissa.com/developer/ or if you are based in Germany you can contact Milissa directly at sales@melissa.de or call Melissa Data at +49 (0)221 97 58 92 40. You are also welcome to visit www.melissa.de.

Technical notes

If your theme uses a custom button/mechanism for triggering place order, the triggerPlaceOrder function has to be overridden accordingly.

Please do: Create a Mixin ( app/design/frontend/<vendor>/<theme>/web/js/mixins/melissa-address-validator.js ) For Mixins see: https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/javascript/js_mixins.html

Add mixin to melissa validator js ( app/design/frontend/<vendor>/<theme>/requirejs-config.js )

var config = {
config: {
mixins: {
'Akitogo_MelissaAddressValidator/js/validator': {
'js/mixins/melissa-address-validator': true
}
}
},

In this example we have a custom methods and buttons for placing order - we are looking for button with different classes that have _active class:

How to install

COMPOSER INSTALLATION

run composer command: $> composer require akitogo/melissa-address-validator

MANUAL INSTALLATION

extract files from an archive

deploy files into Magento2 folder app/code/akitogo/MelissaAddressValidator