LokiCheckout_AddressAutocomplete

Checkout
Other
PHP 8.1 - 8.4
Magento 2.4.7 | 2.4.8
CSP Yes
Integration Tests 1
Functional Tests 5
PHPStan 1
Magento PHPCS 9
Latest Release 1.0.0

This Magento 2 module is an add-on package for adding support for various address autocompletion services (like Google Address Autocompletion, Postcode NL, Post NL) to the LokiCheckout.

Note that this does not require any other third party module.

Note that you will need to install another module to actually add the address autocompletion functionality.

Overview of this module

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.

Installation

Install this package via composer:

composer require loki-checkout/magento2-address-auto-complete

Next, enable this module:

bin/magento module:enable LokiCheckout_AddressAutocomplete

Basic configuration

Configure the settings via the backend (Store > Configuration > Loki Checkout > Address Autocompletion) or via the CLI:

magerun2 config:set loki_checkout/address_autocomplete/enable 1

Dealing with streetlines

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 address 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.

Debugging

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 address autocompletion API.

CLI usage

This module also comes with a simple CLI command to check for specific addresses:

bin/magento loki-checkout:address-auto-complete:check NL 1000AA 1

Support

For getting support, create an Issue under the following project URL:

https://gitlab.yireo.com/loki-checkout/LokiCheckout_AddressAutocomplete.git

Configuration Options

The following options of this module can be configured via the Store Configuration:

Address Autocompletion > Enable
loki_checkout/address_autocomplete/enable
Enable or disable the functionality of Postcode NL
Address Autocompletion > Provider
loki_checkout/address_autocomplete/provider
Address Autocompletion > Debug
loki_checkout/address_autocomplete/debug
Display an additional block in the address with API details, like the raw API result, the values of errors and other handy information.
Address Autocompletion > Require Housenumber to be Numeric
loki_checkout/address_autocomplete/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.
Address Autocompletion > Disable Empty House Number Addition
loki_checkout/address_autocomplete/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).
Address Autocompletion > Save region
loki_checkout/address_autocomplete/save_region
Enable this, if you want to use the API service to autofill the region as well, if possible.
Loki Components

The following LokiComponents are created or references in this module:

loki-checkout.billing.address.address_autocomplete_debug loki-checkout.billing.address.address_autocomplete_toggle loki-checkout.billing.address.country_id loki-checkout.billing.address.postcode loki-checkout.billing.address.street1 loki-checkout.billing.address.street2 loki-checkout.shipping.address.address_autocomplete_debug loki-checkout.shipping.address.address_autocomplete_toggle loki-checkout.shipping.address.country_id loki-checkout.shipping.address.postcode loki-checkout.shipping.address.street1 loki-checkout.shipping.address.street2
Module Dependencies

The following dependencies are declared in the module its `etc/module.xml` file:

LokiCheckout_Core Loki_Base Loki_Components Loki_CssUtils Loki_FieldComponents Loki_MapComponents Magento_Backend Magento_Catalog Magento_CatalogInventory Magento_Checkout Magento_CheckoutAgreements Magento_Config Magento_Customer Magento_Directory Magento_Eav Magento_MediaStorage Magento_Newsletter Magento_Payment Magento_Quote Magento_Sales Magento_Shipping Magento_Store Magento_Tax Magento_Theme Magento_Vault Yireo_CspUtilities
Composer details
Magento module name
LokiCheckout_AddressAutocomplete
Composer name
loki-checkout/magento2-address-auto-complete
Composer version
No release yet
Default branch
main
Requirements
ext-json: *
loki-checkout/magento2-core: ^2.0
loki/magento2-components: ^2.0
loki/magento2-css-utils: ^1.0
loki/magento2-field-components: ^2.0
magento/framework: ^103.0
magento/module-backend: ^102.0
magento/module-checkout: ^100.4
magento/module-config: ^101.0
magento/module-quote: ^101.0
magento/module-store: ^101.0
psr/log: ^1.0 | ^2.0 | ^3.0
Releases
1.0.0 22 April 2026
Changelog

[1.0.0] - 01 April 2026

Fixed

  • Initial release

Last modified: April 1, 2026