Loki Checkout Postcode Nl

Jump to Developer Docs

This module supplies integration with the Postcode EU API to allow for address validation within The Netherlands.

Address fields arranged in a grid that makes sense for Postcode NL
Address fields arranged in a grid that makes sense for Postcode NL

No Dutch shop is complete without proper address validation. This module integrates the Postcode EU API into the LokiCheckout. Once enabled, a customer is able to enter a postcode and house number. Next, the autocompletion logic fills in the streetname, city and region (which are disabled until that moment).

Fields that are to be autocompleted, are disabled
Fields that are to be autocompleted, are disabled

If the autocompletion is not working because the API is down, the "Use autocompletion" flag is automatically disabled. A customer is also able to turn off autocompletion. When autocompletion is disabled, the fields that were disabled are enabled.

Autocompletion logic

When a valid postcode and house number are supplied, which leads into various house number additions to be selected, the Addition field is automatically switched from being a text field into a select field.

When a valid postcode and house number are supplied, however there is no addition, the addition is automatically wiped from the quote. The select field becomes again a text field.

When an exception occurs, usually when the postcode and house number do not lead into a valid combination, the addition, streetname, city and region are wiped from the quote.

Configuration settings

Postcode NL settings in the Magento backend
Postcode NL settings in the Magento backend

Postcode NL > Enable
yireo_loki_checkout/postcode_nl/enable
Enable or disable the functionality of Postcode NL
Postcode NL > Debug
yireo_loki_checkout/postcode_nl/debug
Display an additional block in the address with API details, like the raw API result, the values of errors and other handy information.
Postcode NL > API Key
yireo_loki_checkout/postcode_nl/api_key
The API Key as provided by Postcode EU
Postcode NL > API Secret
yireo_loki_checkout/postcode_nl/api_secret
The API Secret as provided by Postcode EU
Postcode NL > API Check
yireo_loki_checkout/postcode_nl/api_check
Hit the button and a check is performed to see if the API Key and API Secret are valid.
Postcode NL > API Client Timeout
yireo_loki_checkout/postcode_nl/api_client_timeout
A setting to determine after how many seconds an API client call times out.
Postcode NL > Require Housenumber to be Numeric
yireo_loki_checkout/postcode_nl/housenumber_number_validator
With this setting, the value of the "Housenumber" field must be numeric. Note, however, that enabling this might be conflicting with browser autofill options. Perhaps it is best to keep it disabled, even though the idea sounds good.
Postcode NL > Disable Empty House Number Addition
yireo_loki_checkout/postcode_nl/disable_empty_housenumber_addition
When an API call is made and the result suggests that no house number addition is available, this setting automatically disables the "House Number Addition" field (<code>street2</code> aka the third line of the multiline street value).

To use the Postcode EU API, you will need to register for API credentials at www.postcode.eu. The configuration settings in the Magento backend allow you to quickly validate these credentials as well.

Debugging

If shit hits the fan, it is nice to enable the Debug flag. With this, a yellow box is shown with the raw API data response (a JSON object) and some other data that might be useful.

Debugging settings
Debugging settings

Last modified: May 14, 2025