Skip to main content
Easy Digital Downloads Documentation
Documentation, Reference Materials, and Tutorials for Easy Digital Downloads

Change Default Country for Billing Fields

Some payment gateways require that billing info, including country, be filled out. When using one of these gateways, you may want to change the country that is selected by default. This small code snippet will let you do that.

The snippet should be added to a custom plugin or your theme’s functions.php file:

add_action( 'init', function() {
	if ( is_admin() && ! wp_doing_ajax() ) {
		return;
	}

	add_filter( 'edd_shop_country', function( $default ) {
		return 'US';
	} );
}, 5 );