Add a custom currency / symbol in LearnPress

To add a custom currency in LearnPress, you should create child theme because this code is not affected by updates if using a child theme.

Then copy the code below  and paste it in  functions.php file (child theme) and swap out the currency code and symbol with your own (http://prntscr.com/infdqa).
/**
* Add new currency
*
* @param $currencies
*
* @return mixed
*/
function thim_add_learnpress_currency( $currencies ) {
$currencies['Code'] = 'Currency name';
return $currencies;
}

add_filter( 'learn_press_get_payment_currencies', 'thim_add_learnpress_currency' );

/**
* Add new currency symbol
*
* @param $currency_symbol
* @param $currency
*
* @return string
*/
function thim_new_learnpress_currency_symbol( $currency_symbol, $currency ) {
if ( $currency == 'Code' ) {
$currency_symbol = 'Symbol';
}
return $currency_symbol;
}

add_filter( 'learn_press_currency_symbol', 'thim_new_learnpress_currency_symbol', 10, 2 );

After saving changes, it should be available from your LearnPress / Settings / General / Currency (http://prntscr.com/infbjf).

Example: If you want to add Peruvian Sol currency with Code: PEN, Symbol: S/

You have to create child theme then add the code  below to functions.php file (child theme)
/**
* Add new currency
*
* @param $currencies
*
* @return mixed
*/
function thim_add_learnpress_currency( $currencies ) {
$currencies['PEN'] = 'Peruvian Sol - S/';
return $currencies;
}

add_filter( 'learn_press_get_payment_currencies', 'thim_add_learnpress_currency' );

/**
* Add new currency symbol
*
* @param $currency_symbol
* @param $currency
*
* @return string
*/
function thim_new_learnpress_currency_symbol( $currency_symbol, $currency ) {
if ( $currency == 'PEN' ) {
$currency_symbol = 'S/';
}
return $currency_symbol;
}

add_filter( 'learn_press_currency_symbol', 'thim_new_learnpress_currency_symbol', 10, 2 );

Best Deals
Get Eduma Now

For Only *
$439 $69

 
GRAB THE DEAL
* Hurry up! Offer ends this Friday!
close-link
ấdsa
ádasd
ádsad
Subscribe
Give it a try, you can unsubscribe anytime.
close-link
20% OFF all LearnPress premium add-ons

GET 20% OFF COUPON NOW
Your information will never be shared
close-link
Download
LEARNPRESS
WordPress LMS
Download the best WordPress LMS now. Completely Free.
close-link
Learn More