LearnPress LMS Custom code for adding custom currency

Copy the code below and paste it in  functions.php file (child theme) and swap out the currency code and symbol with your own. The reason for advising adding the code in a Child theme is that if you do in the main theme, te code will be wiped out in the next update of theme.

/**
 * Add new currency
 *
 * @param $currencies
 *
 * @return mixed
 */

add_filter('learn_press_get_payment_currencies', 'edubin_learn_press_get_payment_currencies', 10, 1); // for LearnPress 2
add_filter('learn-press/currencies', 'edubin_learn_press_get_payment_currencies', 10, 1); // for LearnPress 3
function edubin_learn_press_get_payment_currencies($currencies)
{
    $currency_new  = 'Code'; # Currency Code
    $currency_name = __('Your Custom Currency Name', 'learnpress'); # Full name of Currency
    if (!isset($currencies[$currency_new]) || (isset($currencies[$currency_new]) && $currencies[$currency_new] !== $currency_name)) {
        $currencies[$currency_new] = $currency_name;
    }
    return $currencies;
}


add_filter('learn_press_currency_symbol', 'edubin_learn_press_currency_symbol', 10, 2);
function edubin_learn_press_currency_symbol($currency_symbol, $currency)
{
    $currency_new = 'Code'; # Currency Code
    if ($currency == $currency_new) {
        $currency_symbol = 'USD' . ' '; # Symbol of currency
    }
    return $currency_symbol;
}