Skip to content

Instantly share code, notes, and snippets.

@travislima
Last active April 7, 2021 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save travislima/b9403f005a2430840624d83a17b241d7 to your computer and use it in GitHub Desktop.
Save travislima/b9403f005a2430840624d83a17b241d7 to your computer and use it in GitHub Desktop.
Change EU Danish Krone currency format
<?php // do not include in Customizations plugin if copying and pasting
/**
* This code gist illustrates a way to customize the format of how your currency displays.
*
* In this example, we will change the PMPro Danish Krone currency
*
* from DKK 1,495.00
* to DKK 1 495,00
*
* Adjust this code gist to suit your needs for currency.
*
* Currency information can be found in this core plugin file `/paid-memberships-pro/includes/currencies.php`
*
* Add this code below to your PMPro Customizations Plugin
* - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
/**
* pmpro_eu_dkk_format This function changes the values of a specific keys for a currency in the `$pmpro_currencies` array.
*
* @param array $pmpro_currencies The currency array created by PMPro
* @return array The adjusted currency array
*/
function pmpro_eu_dkk_format( $pmpro_currencies ) {
$pmpro_currencies['DKK'] = array(
'name' => __( 'Danish Krone', 'paid-memberships-pro' ),
'decimals' => '2',
'thousands_separator' => '&nbsp;',
'decimal_separator' => ',',
'symbol' => 'DKK&nbsp;',
'position' => 'left',
);
return $pmpro_currencies;
}
add_filter( 'pmpro_currencies', 'pmpro_eu_dkk_format' );
@laurenhagan0306
Copy link

This recipe is included in the blog post on "How to adjust your membership site’s default currency format." at Paid Memberships Pro here: https://www.paidmembershipspro.com/how-to-adjust-your-membership-sites-default-currency-format/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment