Gravity Forms Address Enhanced v1.23.0

Gravity Forms Address Enhanced v1.23.0 has been released. It fixes ISO country codes for customised country names, and adds a filter hook for changing state/province names.

Customised country names

When developers had customised some of the country names, the country name wasn’t being converted to the relevant ISO country code. This release fixes that bug.

gf_address_enhanced_state_name

There’s a new filter hook, gf_address_enhanced_state_name, that allows developers to customise the subdivision names displayed for a country. The filter hook passes the original name, the country code, and the subdivision code.

Here’s a simple example of how one might use this filter hook. It changes all subdivision names for Australia to their ISO code — NSW instead of New South Wales, for example.

/**
 * change the subdivision names for Australia to the ISO code
 */
add_filter('gf_address_enhanced_state_name', function(string $name, string $country_code, string $state_code, string $original_name) : string {
    if ($country_code === 'AU') {
        $name = $state_code;
    }
    return $name;
}, 10, 4);

You can update to the latest version from your WordPress plugin admin page. Here’s the full changelog for Gravity Forms Address Enhanced.