Last active
April 7, 2021 04:01
-
-
Save travislima/b9403f005a2430840624d83a17b241d7 to your computer and use it in GitHub Desktop.
Change EU Danish Krone currency format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' => ' ', | |
'decimal_separator' => ',', | |
'symbol' => 'DKK ', | |
'position' => 'left', | |
); | |
return $pmpro_currencies; | |
} | |
add_filter( 'pmpro_currencies', 'pmpro_eu_dkk_format' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/