# Require Latin Characters in Addresses

> Asks customers to type their name and address in Latin letters, for international carriers whose labels cannot print other alphabets.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, checkout, validation, international
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-latin-address-only/

## Code

```php
$wpide_latin_fields = array( 'first_name', 'last_name', 'address_1', 'address_2', 'city' ); // Fields to check.

add_action( 'woocommerce_after_checkout_validation', function ( $data, $errors ) use ( $wpide_latin_fields ) {
    foreach ( array( 'billing', 'shipping' ) as $type ) {
        if ( 'shipping' === $type && empty( $data['ship_to_different_address'] ) ) {
            continue;
        }

        foreach ( $wpide_latin_fields as $field ) {
            $value = (string) ( $data[ $type . '_' . $field ] ?? '' );

            if ( '' !== $value && ! preg_match( '/^[\p{Latin}\p{N}\s\'\-.,\/#&()]+$/u', $value ) ) {
                $errors->add( 'validation', 'Please enter your name and address using Latin letters (A to Z) so the courier can read the label.' );
                return;
            }
        }
    }
}, 10, 2 );
```

## Notes

Accented letters such as é, ü and ø are allowed; edit $wpide_latin_fields to check more or fewer fields.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Require Latin Characters in Addresses" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
