By default, Paid Memberships Pro uses the United States as the country on checkout forms. If your membership site is based in another country or primarily serves customers outside the United States, change this default selection to match your needs. This code recipe sets a different country as the default at checkout.

Featured Image for Change the Default Country of Your Membership Site Checkout

Understanding the Code Recipe

PMPro includes a filter called pmpro_default_country. This filter sets the pre-selected country in the dropdown field at checkout. The value passed through this filter becomes the default unless overridden by user metadata or previous input.

Using this filter allows developers to hard-code a different country code (e.g., GB for the United Kingdom) without needing a custom field or additional plugin. It’s ideal for membership sites operating outside the US that want to localize the checkout experience.

Screenshot of PMPro Checkout With Default Country Selected

How This Code Recipe Works

The recipe hooks into the pmpro_default_country filter and returns the ISO country code you define. In the example provided, the country is changed to the United Kingdom (GB). You can replace GB with any valid ISO 3166-1 alpha-2 country code to match your site’s primary market.

This approach avoids modifying core plugin files or requiring an Add On. It is compatible with all versions of PMPro and works for both logged-in and guest users.

The Code Recipe

Using the Code Recipe

Replace GB with the ISO 3166-1 alpha-2 code for your desired country. Some examples:

  • $default_country = 'CA’; for Canada
  • $default_country = 'AU’; for Australia
  • $default_country = 'ZA’; for South Africa

Adding the Recipe to Your 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.

Free Course: Membership Site Development—The Basics

Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.

Featured Image for Membership Site Development Course: The Basics


Was this article helpful?
YesNo