Adds autocompletion for addresses to the checkout page. Multiple countries are supported using official postal data via the Postcode.eu API.
This plugin has been created by Postcode.eu.
A Postcode.eu account is required. Testing is free. After testing you can choose to purchase a subscription.
Download the most recent release from releases.
In your WordPress administration panel, go to Plugins > Add New and click the Upload Plugin button at the top of the page.
In your WordPress administration panel go to Plugins > Installed Plugins and look for Postcode.eu Address Validation and activate it. Then click on Settings to configure the plugin.
The plugins texts are in English and Dutch, if you want to translate any of the plugins texts you can find out how to do so here: WordPress Localization
Shipping can be limited by setting up Shipping Zones in WooCommerce.
For example, limiting shipping to French overseas territories, set up a shipping zone for France and add a postcode range of 97000...99000. Add specific shipping options, or only local pick up. Make sure the shipping zone is near the top of the list, shipping zones are matched from top to bottom.
Depending on your checkout form fields, the selected address data might not be placed in the fields you would like. The plugin provides the postcodenl_address_field_mapping filter to map WooCommerce address fields to address parts returned by the Postcode.eu API.
Add the filter to your theme's functions.php file or, preferably, to a custom plugin. The keys are WooCommerce address field names and the values are Postcode.eu address parts. Set a value to null when a field should not be populated by the plugin.
Address parts which can be used to populate form fields:
street: Street name without the house number.houseNumber: House number.houseNumberAddition: House number addition or suffix.city: City or locality.postcode: Postal code.streetAndHouseNumber: Street name and house number, including any addition.houseNumberAndAddition: House number and house number addition combined.province: Province or a similar administrative level, such as a state or canton.
For example, to split the street name and building information over two fields:
add_filter('postcodenl_address_field_mapping', function ($mapping) {
$mapping['address_1'] = 'street';
$mapping['address_2'] = 'houseNumberAndAddition';
return $mapping;
});The default mapping is:
address_1→streetAndHouseNumberaddress_2→ not populatedpostcode→postcodecity→citystate→provincestreet_name→streethouse_number→houseNumberhouse_number_suffix→houseNumberAddition
Warning
The mapping applies to newly selected and validated addresses in both the classic and block-based WooCommerce checkout. Changing a mapping does not migrate values already stored in WooCommerce carts, checkout sessions, or customer profiles. Existing data may have been saved in the format of the previous mapping. After changing a mapping, clear active WooCommerce customer sessions and review or migrate saved customer addresses as needed.
The plugin now has support for the new block-based checkout.
This plugin relies on the Postcode.eu API, a third-party service, for address autocompletion and validation. The use of this service is essential for the plugin's functionality, enabling it to provide accurate address suggestions and validations across multiple countries using official postal data.
- The service is used during the checkout process to offer address autocompletion suggestions to the user.
- The plugin communicates with the Postcode.eu API servers to retrieve address data based on the input provided by the user.
- A valid Postcode.eu account is required to access the API services.
For more details on the Postcode.eu API and how to obtain an account, please visit Postcode.eu.
You can find our API documentation at https://developer.postcode.eu/documentation.
- View Frequently Asked Questions at https://www.postcode.eu/#faq.
- For more questions and answers, see https://kb.postcode.nl/help.
- If the above didn't answer your question, contact us.
The code is available under the Simplified BSD License, see the included LICENSE file.