How to Enforce Address Validation for either specific countries or to all countries?

In this article, we take a look at how we can enforce address validation for either specific countries or to all countries in your WooCommerce store whenever a customer enters an address in the address field in the checkout page.

Feature Requirement

This is a business case request from one of our customers who is using our Address Validation & Google Address Autocomplete Plugin. The customer is using the USPS API for validating the address populated to validate the US location addresses only. So when enabling the ‘Enforce Address Validation‘ feature in our plugin for validating the address for all countries, the USPS API doesn’t support address validation for other countries except the US. Also, they are unable to move to other API as they are using the USPS API for free although they are shipping their products to other countries also.

The solution that we arrived upon

So we came up with a solution for adding a new feature in our plugin by which we can enforce address validation options for either specific countries or to all countries. So now customers can select any countries for which they want to validate the addresses for or for those specific countries alone.

You can see the below screenshot of our plugin settings before adding this feature:

Enforce Address Validation

After working on some code snippets in the current version we have come up with a solution by adding the new feature into our plugin and making it feasible for our customers. After certain changes were implemented in the codes of the plugin as well as testing, multiple new features added, we have successfully integrated the feature into our plugin.

Please find the below screenshot after adding the feature :

Enforce Address Validation for specific countries

Final Words

Hence, In this way, we have successfully fulfilled the customer business requirement. Now they can easily validate the addresses based on the country selected. Also, we are planning to add this feature in our latest update, which will be released soon.

If you need more information for all our products then please visit below URL –

https://elextensions.com/

Also, you can give your reviews on our Address Validation & Google Address Autocomplete Plugin through below URL –¬†

https://elextensions.com/plugin/address-validation-google-address-auto-complete-plugin-for-woocommerce/#reviews

    Leave a Reply

    WordPress Image Lightbox Plugin