WOOCS - WooCommerce Currency Switcher

WooCommerce Deposits

Plugin link: https://woocommerce.com/products/woocommerce-deposits/

In file \wp-content\plugins\woocommerce-deposits\includes\class-wc-deposits-cart-manager.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'];
            $total = $total / $rate;
        }
    }
}

On the same file add nex 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'];
            $total = $total / $rate;
        }
    }
}


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

add_filter('woocommerce_deposits_get_deposit_amount', function ($deposit, $prod) {
    if (class_exists('WOOCS')) {
        global $WOOCS;
        $currrent = $WOOCS->current_currency;
        if ($currrent != $WOOCS->default_currency AND $WOOCS->is_multiple_allowed) {
            $currencies = $WOOCS->get_currencies();
            $rate = $currencies[$currrent]['rate'];
            $deposit = $deposit * $rate;
        }
    } return $deposit;
}, 2, 99);