Skip to content

Instantly share code, notes, and snippets.

@kimcoleman
Last active November 19, 2021 16:24
Show Gist options
  • Save kimcoleman/1880f7fc69e51812701cab2ebd5cf547 to your computer and use it in GitHub Desktop.
Save kimcoleman/1880f7fc69e51812701cab2ebd5cf547 to your computer and use it in GitHub Desktop.
Use the pmpro_default_country filter to pre-set the dropdown at checkout to your country of choice.
<?php
/** Use the pmpro_default_country filter to pre-set the dropdown at checkout to your country of choice.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
*
*/
function my_set_pmpro_default_country( $default_country ) {
// Set country code to "GB" for United Kingdom.
$default_country = "GB";
return $default_country;
}
add_filter( 'pmpro_default_country', 'my_set_pmpro_default_country' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment