WOOCS - WooCommerce Currency Switcher

WooCommerce Dynamic Pricing (by WooCommerce)

Plugin URL: https://woocommerce.com/products/dynamic-pricing/

//in file \plugins\woocommerce-dynamic-pricing\classes\modules\class-wc-dynamic-pricing-advanced-totals.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'];
            $rule['from'] = $rule['from'] * ($rate);
            $rule['to'] = $rule['to'] * ($rate);
        }
    }
}


//in your wp theme functions.php file add next code:
add_filter('wc_dynamic_pricing_apply_cart_item_adjustment', 'woocs_fix_dinamic_price', 999, 4);

function woocs_fix_dinamic_price($adjusted_price, $cart_item_key, $original_price, $module) {
    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'];
                $adjusted_price = $adjusted_price / ($rate);
            }
        }
    }

    return $adjusted_price;
}