How to Set the Default Address Scheme to International

Overview

Would you like to set the default Address Scheme to International for all of your WPForms? 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.

by default, when adding an Address form field, US is defaulted as the first option in the Scheme dropdown

You can easily change the default Scheme to International by adding a small code snippet. In this article, we’ll walk you through how to do exactly that!

Setup

To begin, you’ll need to copy a snippet to your site.

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.

you have now set the default address scheme

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.