How to validate shipping addresses in WooCommerce
WooCommerce validates required shipping fields, country codes and postcode formats, but it does not confirm that a complete street address exists. Configure shipping zones first, then add custom validation or use postcode lookup when delivery accuracy matters.
- 01Configure shipping countries and zones
- 02Know what WooCommerce checks
- 03Use the manual validation route
- 04Test the complete checkout flow
- 05Fix common validation failures
- 06Add postcode address lookup
What you need
- A WooCommerce store with physical products
- Admin access to WordPress and WooCommerce
- A test address for each country or shipping zone
Configure shipping countries and zones
Go to WooCommerce > Settings > General and confirm the countries you sell to and the countries you ship to. Then open WooCommerce > Settings > Shipping and create the shipping zones, methods and rates that match your delivery areas.
WooCommerce uses the first matching shipping zone, so put specific regions before broader ones. A valid address can still show no delivery method if the postcode, state or country does not match an available zone.
Know what WooCommerce checks
WooCommerce checks whether required fields are present, whether the selected country is valid and whether the postcode follows the format recognised for that country. It can also normalise postcode formatting during checkout.
These checks do not prove that a street, house number or postcode belongs to a real deliverable address. A customer can enter a plausible but incorrect address and still place an order.
Use the manual validation route
For a simple rule such as requiring a house number, a developer can add a callback to WooCommerce's woocommerce_after_checkout_validation action. The callback can inspect the submitted shipping fields and add an error when a rule fails. WooCommerce will then return the customer to checkout instead of creating the order.
Keep country differences in mind. A regular expression that expects numbers in every street address will reject legitimate addresses, and this hook is intended for the classic shortcode checkout. The newer Checkout block uses a different processing path, so test the actual checkout used by your site.
Test the complete checkout flow
Place test orders using a valid address, an invalid postcode, a missing house number, a postcode outside the shipping zone and an address in a country you do not serve. Check both the error message and the shipping methods shown after the address changes.
Also test guest checkout, logged-in checkout and mobile checkout. Checkout updates shipping rates dynamically, so an address that passes field validation may still produce a no shipping options result if the zones or methods are wrong.
Fix common validation failures
If postcode lookup or address verification does not appear, check that the checkout still includes the country field. Address tools use the selected country to interpret the postcode. On classic checkout, JavaScript errors from a theme or another plugin can also stop lookup and checkout updates from working.
For a lookup service, recheck the API key, access token and account credits. If you edited checkout fields, restore the country, state, city and postcode fields before troubleshooting; country-dependent address fields have special WooCommerce rules and may not accept ordinary custom validation settings.
Add postcode address lookup
When you need customers to select a verified-looking address rather than type every field manually, use WooCommerce Postcode Address Validation. It adds postcode lookup and address autocomplete at checkout, which is a faster route for reducing incomplete or mistyped shipping addresses than writing and maintaining country-specific validation rules.
After installing it, configure the provider and supported countries in its settings, then test the lookup on the checkout and My Account address screens. Keep the normal WooCommerce fields and shipping zones in place: lookup improves the address entry process, but it does not replace shipping-rate configuration.
Let WooCommerce Postcode Address Validation do it
Real-time postcode lookup and address autocomplete at checkout; ideal for reducing delivery errors over basic checkout fields.
Sources
- woocommerce.com /documentation/woocommerce/shipping/?utm_source=openai
- github.com /woocommerce/woocommerce/blob/trunk/plugins/woocommerce/incl…
- woocommerce.github.io /code-reference/hooks/hooks?utm_source=openai
- github.com /woocommerce/woocommerce/issues/41763?utm_source=openai
- woocommerce.com /document/address-validation/?utm_source=openai
Questions
- Does WooCommerce validate a shipping address automatically?
- WooCommerce validates required fields, country codes and country-specific postcode formats, but it does not normally confirm that a street address exists or that a house number is deliverable. For that level of checking, you need custom code connected to an address service or a postcode and address validation extension.
- Can I validate shipping postcodes without a plugin?
- Yes, WooCommerce already checks postcode format and you can add custom rules with code. A developer can use the classic checkout validation action to inspect submitted shipping data and add an error. This works well for narrow rules, but maintaining country-specific formats and supporting the Checkout block makes a lookup service more practical for many stores.
- Why does a valid address show no shipping options?
- A valid address can show no shipping options when it does not match an enabled shipping zone or method. Check the country, state and postcode, then review zone order because WooCommerce uses the first zone that matches. Confirm that the product requires shipping and that the selected method is available for that destination.
- Will postcode lookup block every unverified address?
- Not necessarily. Address verification services may suggest a corrected address without blocking checkout, because new buildings, unusual addresses or temporary service failures can produce a failed result. If every failed lookup must stop the order, confirm that the chosen extension or provider supports blocking and test the fallback behaviour before enabling it.