How to Set the Address Default Scheme to International

Overview

Would you like to have the Address field set the default Scheme to International? You can easily change the default by adding a small code snippet and we’ll show you how.

Setup

Currently, the default when you add the field is set to US but to change this, just copy and paste this code snippet to your site.

The current default scheme when adding the address field is to have it set to the US

If you need assistance in adding a code snippet, please review this tutorial.

/*
 * Change the scheme for the address field 
 *
 * @link https://wpforms.com/developers/how-to-set-the-address-default-scheme-to-international
 *
 */

function wpf_dev_field_new_default( $field ) {

	// default scheme set to international
	if ($field['type'] === 'address') {

		$field['format'] = 'international';

		$field['scheme_selected'] = 'international';

		$field['scheme'] = 'international';

		$field['country_hide'] = 'wpforms-hide';

	}

// Return
return $field;

}

add_filter( 'wpforms_field_new_default', 'wpf_dev_field_new_default', 10, 1 );

Once the snippet is added, each time you add the Address field to your form, the Scheme will have International selected for you by default.

With the snippet added, you'll now have the address default scheme set to Interational

And that’s it! Would you like to create your own Schemes for the Address form field? Take a look at our article on How to Create Additional Schemes for the Address Field.