This is an add-on package for adding support for the Postcode NL address validation and autocompletion to the LokiCheckout.
This module changes the layout of an address form, so that a streetname and city can be determined by entering a postcode and housenumber (plus housenumber addition). Because the Magento core stores the street as multiple streetlines, the fields are renamed by this module: The field street0
is renamed to Streetname, the field street1
is renamed to House Number, the field street2
is renamed to House Number Addition. The field street3
is not handled by this module.
The fields Streetname and City are disabled when autocompletion is enabled.
An additional checkbox Use autocompletion is added to allow customers to disable the Postcode NL lookup. When autocompletion is disabled (HTML attribute disabled
), the fields Streetname and City are enabled again.
Portions of this module are shamelessly copied (and rewritten) from the Trinos_PostcodeNL
module. Thank you, Trinos, for kickstarting this module. Note that this module is not depending on the Trinos module though.
Install this package via composer (assuming you have setup the composer.yireo.com
repository correctly already):
composer require loki-checkout/magento2-postcode-nl
Next, enable this module:
bin/magento module:enable LokiCheckout_PostcodeNl
Configure the Postcode NL settings via the backend (Store > Configuration > Yireo > Loki Checkout > Postcode NL) or via the CLI:
magerun2 config:set loki_checkout/postcode_nl/enable 1
magerun2 config:set loki_checkout/postcode_nl/api_key YOUR_API_KEY
magerun2 config:set loki_checkout/postcode_nl/api_secret YOUR_API_SECRET
In the backend, you can also validate the credentials right away via the button Validate API credentials.
We recommend you to set the configuration value customer/address/street_lines
to be 3.
If the configuration value customer/address/street_lines
is 3, both the field House Number and House Number Addition are taken into account when dealing with the Postcode NL autocompletion. When there are multiple options for the housenumber addition, the House Number Addition changes from an input field to a select field. When there are no options to choose from, you can also disable the field itself by setting the configuration option Disable Empty House Number Addition to Yes. Likewise, the configuration option Require Housenumber to be Numeric can be enabled to force the value of the field House Number to be numeric.
If the configuration value customer/address/street_lines
is 2, the field House Number Addition is never shown. Instead, the value of House Number allows for adding the addition as well (like: 10A). Here, it is assumed that the numerical prefix is the value for the house number (10) and the remainder is the addition (A). The configuration option Require Housenumber to be Numeric has no effect at this moment.
When the configuration option Debug is enabled, a new block is shown in the checkout (with yellow background). The autocompletion state (saved to the checkout session) is shown.
Possible errors are shown as well. For instance Housenumber addition is not available: A [street1, street2]
would tell you that a specific local error is shown for the components street1
and street2
.
The raw API data show the response from the Postcode NL API.
This module also comes with a simple CLI command to check for specific addresses:
bin/magento loki-checkout:postcode-nl:check 1000AA 1 A
For getting support, create an Issue under the following project URL:
https://gitlab.yireo.com/loki-checkout/LokiCheckout_PostcodeNl
The following options of this module can be configured via the Store Configuration:
loki_checkout/postcode_nl/enable
loki_checkout/postcode_nl/debug
loki_checkout/postcode_nl/api_key
loki_checkout/postcode_nl/api_secret
loki_checkout/postcode_nl/api_check
loki_checkout/postcode_nl/api_client_timeout
loki_checkout/postcode_nl/housenumber_number_validator
loki_checkout/postcode_nl/disable_empty_housenumber_addition
The following LokiComponents are created or references in this module:
loki-checkout.shipping.address.postcode_nl_toggle
loki-checkout.billing.address.postcode_nl_toggle
loki-checkout.shipping.address.postcode_nl_debug
loki-checkout.billing.address.postcode_nl_debug
loki-checkout.shipping.address.postcode
loki-checkout.billing.address.postcode
loki-checkout.shipping.address.street1
loki-checkout.billing.address.street1
loki-checkout.shipping.address.street2
loki-checkout.billing.address.street2
loki-checkout.shipping.address.country_id
loki-checkout.billing.address.country_id
The following dependencies are declared in the module its `etc/module.xml` file:
Magento_Backend
Magento_Checkout
Magento_Config
Magento_Customer
Magento_Quote
Magento_Store
LokiCheckout_Core
Loki_Components
Loki_FieldComponents
Yireo_IntegrationTestHelper
LokiCheckout_PostcodeNl
loki-checkout/magento2-postcode-nl
magento/framework: ^103.0
magento/module-backend: ^102.0
magento/module-checkout: ^100.4
magento/module-config: ^101.0
magento/module-customer: ^103.0
magento/module-quote: ^101.0
loki-checkout/magento2-core: ^2.0
loki/magento2-field-components: ^2.0
loki/magento2-css-utils: ^1.0
loki/magento2-components: ^2.0
composer/composer: ^2.8
psr/log: ^3.0
guzzlehttp/guzzle: ^6.0|^7.0
ext-json: *
dev-feature/improve-ux | 16 August 2025 |
dev-main | 29 August 2025 |
2.0.8 | 27 August 2025 |
2.0.7 | 26 August 2025 |
2.0.6 | 21 August 2025 |
2.0.5 | 18 August 2025 |
2.0.4 | 15 August 2025 |
2.0.3 | 13 August 2025 |
2.0.2 | 06 August 2025 |
2.0.1 | 01 August 2025 |
2.0.0 | 22 July 2025 |
loki-col-span
properlyLokiCheckout_Nl
moduleloki_checkout.xml
default gridloki_checkout.xml
of Nl and PostcodeNl module to Demo modulehousenumber_number_validator
by default because it conflicts with autofillloki_checkout.xml
grid CSS for mobile