Does your membership site primarily serve one region or country of members?

This recipe demonstrates how to set the default country (United States — US) for your PMPro-powered membership site. This is useful for sites that collect a Billing Address and want to speed up the checkout process, eliminating the need for members to find their country before proceeding.

This code recipe uses the pmpro_default_country filter to pre-set the dropdown at checkout to your country of choice. If your country isn’t in the list, you can also add it using the pmpro_countries filter.

Banner for Change the Default Country of Your Membership Site Checkout

The Code Recipe

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.

Change the country code on line of the code recipe below to match your own. The code recipe above is currently set to GB “United Kingdom”. For a list of supported country codes see includes/countries.php. If the country you would like to use is not in this list, you can add it using the pmpro_countries filter hook.

Screenshot of a site with the default country set to United Kingdom at membership checkout.

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