WOOCS - WooCommerce Currency Switcher

YITH WooCommerce Account Funds

Plugin link: https://yithemes.com/themes/plugins/yith-woocommerce-account-funds/

In file  \wp-content\plugins\yith-woocommerce-account-funds-premium\includes\class.yith-ywf-deposit-fund-checkout.php add next code:

if (class_exists('WOOCS')) {
    global $WOOCS;
    if ($WOOCS->is_multiple_allowed) {
        $currrent = $WOOCS->current_currency;
        if ($currrent != $WOOCS->default_currency) {
            $currencies = $WOOCS->get_currencies();
            $rate = $currencies[$currrent]['rate'];
            $amount = $amount / $rate;
        }
    }
}

In file \wp-content\plugins\yith-woocommerce-account-funds-premium\includes\class.yith-ywf-customer.php add next code (twice as on the image below):

if (class_exists('WOOCS')) {
    global $WOOCS;
    if ($WOOCS->current_currency != $WOOCS->default_currency) {
        $currencies = $WOOCS->get_currencies();
        $new_funds = $new_funds / $currencies[$WOOCS->current_currency]['rate'];
    }
}


In file  \wp-content\plugins\yith-woocommerce-account-funds-premium\includes\class.wc-gateway-yith-funds.php delete next code:


In file functions.php of the current wordpress theme add next code:

<?php

add_filter('yith_show_available_funds', function($fund_av) {
    if (class_exists('WOOCS')) {
        global $WOOCS;
        if ($WOOCS->is_multiple_allowed) {
            $fund_av = $WOOCS->woocs_exchange_value($fund_av);
        }
    }
    return $fund_av;
});
add_filter('yith_show_used_funds', function($fund_av) {
    if (class_exists('WOOCS')) {
        global $WOOCS;
        if ($WOOCS->is_multiple_allowed) {
            $fund_av = $WOOCS->woocs_exchange_value($fund_av);
        }
    }
    return $fund_av;
});
add_filter('yith_min_deposit', function($fund_av) {
    if (class_exists('WOOCS')) {
        global $WOOCS;
        if ($WOOCS->is_multiple_allowed) {
            $fund_av = floor($WOOCS->woocs_exchange_value($fund_av));
        }
    }
    return $fund_av;
});
add_filter('yith_max_deposit', function($fund_av) {
    if (class_exists('WOOCS') AND $fund_av) {
        global $WOOCS;
        if ($WOOCS->is_multiple_allowed) {
            $fund_av = ceil($WOOCS->woocs_exchange_value($fund_av));
        }
    }
    return $fund_av;
});