Whatever the browser sends, the server checks every Vietnamese address again and stores the official ward code next to it.
What is checked
For billing and shipping addresses in Vietnam — at checkout (block and classic) and when a customer saves an address in My Account — the plugin looks for the typed ward among the wards of the chosen province.
- Found: the name is replaced by the official one (
ben thanh→ Phường Bến Thành) and its code is saved. - Not found, with Require a valid ward on: the order is refused with a clear message, for example “Billing address: “Ben Thanh 2” is not a ward / commune of TP. Hồ Chí Minh. Choose one from the list.”
- Not found, with that option off: the address is kept as typed, without a code.
An empty ward field gets WooCommerce’s own “required field” message. Addresses outside Vietnam are never touched.
Where the code is saved
| Meta key | Saved on | Value |
|---|---|---|
_vafw_billing_ward | Orders and customers | 5-digit official code of the billing ward |
_vafw_shipping_ward | Orders and customers | 5-digit official code of the shipping ward |
The province stays in WooCommerce’s state field (key such as HCM) and the ward name in the city field. On the order screen, the code is shown under each address as Ward / commune code.
Change the matching
The vafw_find_ward filter receives the match and can replace it — for example to accept a local nickname. See Hooks and filters.