A Cozmoslabs Product
Documentation / Developer Knowledge Base / Pre-select country for Billing Fields

Pre-select country for Billing Fields

If you have the Billing Details section showing in your form and want to pre-select the country, you can use the following snippet of code:

1
2
3
4
5
6
add_filter( 'pms_extra_form_fields', 'pmsc_preselect_country', 99 );
function pmsc_preselect_country( $fields ) {
	$fields['pms_billing_country']['default'] = 'US';
 
	return $fields;
}

This would set the default country to United States.
Replace `US` with the ISO Country Code that you wish to be pre-selected (ex. DE -> Germany, IT -> Italy, CA -> Canada etc).

The Ultimate Membership Bundle

Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.

Get 25% off with the bundle

Help & Support

We’re here to help you every step of the way.

Open a Support Ticket