PHPackages                             addressfinder/module-magento2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. addressfinder/module-magento2

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

addressfinder/module-magento2
=============================

Address Autocomplete for your Magento 2 store by AddressFinder

2.1.1(1y ago)9117.4k↑630.8%6[4 issues](https://github.com/AddressFinder/addressfinder-magento/issues)[1 PRs](https://github.com/AddressFinder/addressfinder-magento/pulls)OSL-3.0PHPPHP ~7.1||~8.0

Since Sep 12Pushed 1y ago10 watchersCompare

[ Source](https://github.com/AddressFinder/addressfinder-magento)[ Packagist](https://packagist.org/packages/addressfinder/module-magento2)[ RSS](/packages/addressfinder-module-magento2/feed)WikiDiscussions develop Synced 3w ago

READMEChangelogDependencies (4)Versions (42)Used By (0)

AddressFinder for Magento 2
===========================

[](#addressfinder-for-magento-2)

The AddressFinder module for Magento 2 allows you to find verified [Australian](https://addressfinder.com.au) and [New Zealand](https://addressfinder.nz) addresses with an intuitive, search-as-you-type interface.

1. Installation
---------------

[](#1-installation)

The module may be installed one of two ways:

1. Composer (recommended)
2. Manual

### 1.1 Via Composer

[](#11-via-composer)

To install the module via Composer, from the root directory of your Magento installation:

```
composer require addressfinder/module-magento2
```

This will automatically fetch the latest compatible version of the module available to your Magento installation. From the root directory of your Magento installation:

```
bin/magento module:enable AddressFinder_AddressFinder
bin/magento setup:upgrade
```

### 1.2 Install manually

[](#12-install-manually)

To install the module manually, download the source code for the latest **compatible version** of the module:

Magento VersionLatest Compatible Version2.0.\*[1.3.0 (download)](https://github.com/AddressFinder/addressfinder-magento/releases/tag/v1.3.0)2.1.\*[1.5.1 (download)](https://github.com/AddressFinder/addressfinder-magento/releases/tag/v1.5.1)2.2.\*[1.5.1 (download)](https://github.com/AddressFinder/addressfinder-magento/releases/tag/v1.5.1)2.3.\*[2.0.4 (download)](https://github.com/AddressFinder/addressfinder-magento/releases/tag/v2.0.4)2.4.\*[2.0.5 (download)](https://github.com/AddressFinder/addressfinder-magento/releases/tag/v2.0.5)2.4.\*[2.1.0 (download)](https://github.com/AddressFinder/addressfinder-magento/releases/tag/v2.1.0)2.4.\*[2.1.1 (download)](https://github.com/AddressFinder/addressfinder-magento/releases/tag/v2.1.1)Extract the `.zip` / `.tar.gz` you have downloaded. Copy the **contents of the top-level folder** that was created during extraction into your Magento store in the following location (you must create these folders manually):

```
app/code/AddressFinder/AddressFinder/

```

After copying the contents into this location, you should see a structure containing (but not limited to) the following files/folders:

```
app/code/AddressFinder/AddressFinder/Block/
app/code/AddressFinder/AddressFinder/etc/
app/code/AddressFinder/AddressFinder/Model/
app/code/AddressFinder/AddressFinder/registration.php
app/code/AddressFinder/AddressFinder/...

```

From the root directory of your Magento installation:

```
bin/magento module:enable AddressFinder_AddressFinder
bin/magento setup:upgrade
```

### 1.3 Production considerations

[](#13-production-considerations)

Although outside the scope of installing this module, if you are running your Magento store in a production environment, you should run the [Magento code compiler](https://devdocs.magento.com/guides/v2.4/config-guide/cli/config-cli-subcommands-compiler.html) and [deploy static files](https://devdocs.magento.com/guides/v2.4/config-guide/cli/config-cli-subcommands-static-deploy-strategies.html):

```
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
```

2. Updating
-----------

[](#2-updating)

The process for updating the module depends on whether you have installed it via Composer or manually.

### 2.1 Via Composer

[](#21-via-composer)

To update the module via Composer, from the root directory of your Magento installation:

```
composer update addressfinder/module-magento2
bin/magento setup:upgrade
```

> If you are running your Magento store in a production environment, refer to Section (1.3) Production Considerations.

### 2.2 Update manually

[](#22-update-manually)

To update the module manually, referring to the instructions in Section (1.2) Install Manually to download the latest compatible version and copy the files into your Magento codebase. After you have copied these files in, simply upgrade the extension:

```
bin/magento setup:upgrade
```

> If you are running your Magento store in a production environment, refer to Section (1.3) Production Considerations.

3. Configuring the module
-------------------------

[](#3-configuring-the-module)

The module's settings are controlled within `Stores -> Configuration -> Services -> AddressFinder`.

> Most settings in Magento 2 are guarded with sensible defaults. To customise settings, you'll need to uncheck the **use system value** for any settings you would like to customise.

### 3.1 Basic functionality

[](#31-basic-functionality)

To get the module functioning in its most basic form, you'll need to:

1. Change **Enabled** to **Yes**.
2. Sign up for a licence key for [Australia](https://addressfinder.com.au/plans/?utm_source=magento&utm_medium=extension&utm_campaign=magento_admin&utm_term=Australia) or [New Zealand](https://addressfinder.nz/plans/?utm_source=magento&utm_medium=extension&utm_campaign=magento_admin&utm_term=New_Zealand) and enter this in the **License** field.

### 3.2 Customisation features

[](#32-customisation-features)

1. Depending on the theme your Magento store has, you may need to configure the **Default Search Country** if your checkout has no country selector.
2. AddressFinder functions across many forms throughout Magento. The default is to enable it in all supported forms, however you may restrict this with the **Enable Specific Forms** setting.
3. Turning on **Debug Mode** will print debug messages from the AddressFinder JavaScript widget to the browser's console.
4. You may pass custom **Widget Options** to the JavaScript widget. This must be a JSON object valid for [Australia](https://addressfinder.com.au/docs/widget_docs?utm_source=magento&utm_medium=extension&utm_campaign=magento_admin&utm_term=Australia#options) or [New Zealand](https://addressfinder.nz/docs/widget_docs?utm_source=magento&utm_medium=extension&utm_campaign=magento_admin&utm_term=New_Zealand#options).

4. Forms
--------

[](#4-forms)

The AddressFinder module is installed within Magento by attaching forms. Out of the box, we support the following frontend forms:

1. Checkout billing address
2. Checkout shipping address
3. Customer address book

In addition, we support the following admin forms:

1. Order billing address
2. Order shipping address

### 4.1 Adding a new form (advanced)

[](#41-adding-a-new-form-advanced)

Of course, you may wish to add support for a new form. Luckily, this process is fairly straightforward, however a level of Magento development knowledge is assumed.

> **Important:** All of the examples to follow will assume we'll be working with a module called `Acme_CustomForm`.

#### 4.1.1 Module creation

[](#411-module-creation)

You'll firstly need your own module [create your own module](https://devdocs.magento.com/videos/fundamentals/create-a-new-module/). Begin by creating the following folder structure:

```
app/code/Acme/CustomForm/
app/code/Acme/CustomForm/etc/
app/code/Acme/CustomForm/Observer/Config/Source/Frontend/
app/code/Acme/CustomForm/Observer/FormConfig/Frontend/

```

Create a component registration file at `app/code/Acme/CustomForm/registration.php`:

```

```

#### 4.1.2 Event observers

[](#412-event-observers)

Within your module, you'll need to [create event observers](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/events-and-observers.html) that'll allow us to add our custom forms to the AddressFinder module. We'll create a frontend form for brevity's, however the process is [almost identical](https://github.com/AddressFinder/addressfinder-magento/blob/develop/etc/events.xml) for admin forms.

Begin by creating an events file at `app/code/Acme/CustomForm/etc/events.xml`:

```

```

#### 4.1.3 Form implementation

[](#413-form-implementation)

You'll notice we referred to two new classes within our event observers. We need to implement these classes.:

1. The first class will be used to define the form
2. The second class will add the ability to restrict form selection in the admin. *The second class is optional; only required if you wish to restrict forms instead of showing all.*

Start by creating the form declaration at `app/code/Acme/CustomForm/Observer/FormConfig/Frontend/AddStoreLocator.php`:

```
