Currency formatting varies from country to country. For example, the placement of a comma (“,”) or period (“.”) in a currency format can mean something completely different depending on what currency is being used. Our core plugin offers formatting for several built-in currencies, which you can specify on the Memberships > Payment Settings page, but what if your currency is not being properly represented?
This code recipe demonstrates how to use the
pmpro_currencies filter to adjust the format to match your desired currency.
About the Code Recipe
A couple of weeks ago, a member from Europe asked us to format the currency for their membership site to prevent any billing confusion. They were based in Denmark, and the core plugin did not include formatting for the Danish Krone.
The code recipe below is an example of how you can change the formatting of your currency from
1 495,00, which is the proper format for Denmark. While this code recipe is specific to the Danish Krone, it demonstrates how to leverage the
pmpro_currencies filter and can be altered to suit your needs.
If you are looking to add a new default currency to your membership site, have a look at this article which further explains the filter.
The Code Recipe
Adding the recipe to your website
Copy and paste this code recipe into a helper PMPro Customizations plugin.
This code recipes was written by our very own Travis Lima.