• If you select United Kingdom as the country in WooCommerce now, the list of ‘counties’ is actually a list of countries like England, Wales, Guernsey, Jersey, Gibralter etc. and not UK Counties like Bedfordshire, Buckinghamshire, Nottinghamshire, Suffolk, Kent etc.

    It looks really weird selecting UK as the country and then having to select England as the county, when it’s actually the country again and there are no county options.

    It wasn’t an issue before updating, and it’s on all the sites with the latest version of WooCommerce. Can this be fixed so the Counties field actually shows counties again?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter thelyall

    (@thelyall)

    Another option would be to change it to an empty text input (not a select list) as most of the time that’s how the county field appears in stores here in the UK. That would actually be more normal/common.

    Thread Starter thelyall

    (@thelyall)

    Is this going to be fixed/included in an update or do I need to write a function to change the field to text instead of a select?

    Thanks

    Thread Starter thelyall

    (@thelyall)

    I’ve fixed this by installing WooCommerce Locations Pack plugin to add the list of correct UK counties to the list of incorrect ones, then I added the following function to my child theme to remove the ones that shouldn’t be there:

    add_filter( 'woocommerce_states', 'custom_uk_states', 10, 1 );
    function custom_uk_states( $states ) {
        $non_allowed_uk_states = array( 'England', 'Scotland', 'Wales', 'Other', 'Isle of Man', 'Anguilla', 'Bermuda', 'British Indian Ocean Territory', 'British Virgin Islands', 'Cayman Islands', 'Falkland Islands', 'Gibraltar', 'Montserrat', 'Northern Ireland', 'Pitcairn Islands', 'South Georgia & South Sandwich Islands', 'St Helena, Ascension, Tristan da Cunha', 'Turks and Caicos Islands', 'Guernsey', 'Jersey'); 
    
        // Loop through your non allowed us states and remove them
        foreach( $non_allowed_uk_states as $state_code ) {
            if( isset($states['GB'][$state_code]) )
                unset( $states['GB'][$state_code] );
        }
        return $states;
    }

    Unlike with US states which use the state code as the value, it appears the UK ones just use the full name.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘United Kingdom Counties List – contains countries not counties’ is closed to new replies.