FOX - Currency Switcher for WooCommerce

LearnPress – WordPress LMS Plugin

Plugin URL: https://wordpress.org/plugins/learnpress/
  • In  file wp-content\plugins\learnpress-woo-payment\incs\class-wc-product-lp-course.php change next code:
    $price = ($course) ? $course->get_price() : 0;
    if ($price) {
        if (class_exists('WOOCS')) {
            global $WOOCS;
            if ($WOOCS->is_multiple_allowed) {
                $price = $WOOCS->woocs_exchange_value(floatval($price));
            }
        }
    }
    return $price;
    
  • In file wp-content\plugins\learnpress\inc\course\abstract-course.php add next code:
    if ($sale_price_value) {
        if (class_exists('WOOCS')) {
            global $WOOCS;
            if ($WOOCS->is_multiple_allowed) {
                $sale_price_value = $WOOCS->woocs_exchange_value(floatval($sale_price_value));
            }
        }
    }
    
    LearnPress – WordPress LMS PluginLearnPress – WordPress LMS PluginLearnPress – WordPress LMS PluginLearnPress – WordPress LMS Plugin
  • And in functions.php of the current wp theme add next code:
    add_filter('learn-press/course/regular-price', function ($price, $id) {
        if ($price) {
            if (class_exists('WOOCS')) {
                global $WOOCS;
                if ($WOOCS->is_multiple_allowed) {
                    $price = $WOOCS->woocs_exchange_value(floatval($price));
                }
            }
        }
        return $price;
    }, 10, 2);
    
    add_filter('learn-press/currency', function ($currency) {
        if (class_exists('WOOCS')) {
            global $WOOCS;
            $currency = $WOOCS->current_currency;
        }
        return $currency;
    });
    
     
This edit is inside another plugin's file, so a plugin update will undo it. Write the change down, and re-apply it after every update of that plugin — or ask its authors to include the fix on their side, which is the only version that survives. If the change is inside FOX itself, tell us: a fix that has to be re-applied by hand is a bug on our side, not a solution.