How can I change the default country from the United States to something else in the address drop down?

Article Last Updated: February 23, 2016

Since version 6.0.4.3 of Easy Forms for MailChimp by YIKES we’ve included a new filter allowing you to specify which country you want to be pre-selected in the country dropdown. In previous versions the United States was the default, and users outside of the United States were forced to change the value. We wanted international users to be able to specify a default value for the country dropdown, so their users don’t have to go through the steps of altering the dropdown.

Using the built in filter `yikes-mailchimp-default-country-value`, users can now specify the default country.

Parameters:

  • $country_abbrev – The default country to use for the dropdown (Defaults to ‘US’).
  • Example:

    /**
    *	Set a default the default value to 'United Kingdom' for the country dropdown
    *	@resource: https://github.com/yikesinc/yikes-inc-easy-mailchimp-extender/issues/452
    *       @note: specify your country values in ISO 3361 Alpha-2 code (for help see: http://www.freeformatter.com/iso-country-list-html-select.html)
    */
    function yikes_mailchimp_set_default_country_in_dropdown( $country_abbrev ) {
    	$country_abbrev = 'GB';
    	return $country_abbrev;
    }
    add_filter( 'yikes-mailchimp-default-country-value', 'yikes_mailchimp_set_default_country_in_dropdown' );
    

    You’ll want to add the above snippet to your themes functions.php file. Once added, you can alter the $country_abbrev value to the value you need.

    Once saved, you should now be seeing the country default to ‘United Kingdom’, or whatever value you specified.