Smarty Address Validation (formerly SmartyStreets) looks up the shipping address entered by your customer and attempts to verify that it is the correct address using the Smarty Address APIs.
Like many features, we encourage merchants to be cautious about enabling functionality like this. Requiring a customer to validate the address they entered adds some additional friction to the checkout process and could result in lower conversions.
We encourage merchants to enable this feature if they have regular issues with failed orders due to incorrect address entry.
Configuration
To setup Smarty, you’ll need an account with them: https://www.smarty.com/pricing
If all of your customers are based in the United States, you can purchase a US Address plan. If you have low volume, you can use their free tier which includes 250 lookups a month.
If you are not based in the US or sell to multiple countries, you’ll also need their International Address API: https://www.smarty.com/pricing/international-address-autocomplete
Once you have signed up for the required APIs, you can login to Smarty and access your API Keys: https://www.smarty.com/account/keys
You’ll want to generate a Secret Key which looks like this:
You’ll enter those keys in WP Admin > CheckoutWC > Checkout:
Considerations and Edge-cases
Precision
Addresses are complex and sometimes even a first-class validation service like Smarty can’t verify an address completely. Smarty indicates how precisely it verifies an address. Occasionally Smarty will say it can only verify an address down to the “Locality,” meaning it’s only confident that the city, state, and country etc are correct. When this occurs we lean towards trusting the user to correctly input their address and we won’t show them a confirmation popup.
United Kingdom
The United Kingdom’s addresses are such that sometimes cities or neighborhoods are suggested for address line 2. Because of this we check to make sure the Smarty suggestion for Address Line 2 isn’t a duplicate of another component already in the address.
The United Kingdom’s addresses are also such that sometimes the Address Line 1 and Address Line 2 are the reverse of how we would normally expect them to be in the US and how WooCommerce would expect. Example: Apt 20 may end up in address_1 and “10 Downing St” in address_2.
Unfortunately these are the foibles of addresses and particularly UK addresses. If this causes problems for your customers and you have a lot of UK customers, you may wish to disable the feature.
Frequently Asked Questions
What happens when I run out of lookups?
If you run out of lookups, address validation should fail silently and the user will be advanced to the next step without having to verify their address.