Skip to content

Set the default country for checkout #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions checkout/set-pmpro-default-country.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* Use the pmpro_default_country filter to pre-set the dropdown at checkout to your country of choice.
* *
* title: Change the Default Country of Your Membership Site Checkout.
* layout: snippet
* collection: misc
* category: checkout
* link: https://www.paidmembershipspro.com/change-the-default-country-of-your-membership-website/
*
* 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.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
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' );