FOX - Currency Switcher Professional for WooCommerce

YITH WooCommerce Role Based Prices

Plugin URL: https://yithemes.com/themes/plugins/yith-woocommerce-role-based-prices/

This doesn’t fix bug with mini-basket and not depends of WOOCS code

//in your wp theme functions.php file add all next code:

add_filter('yith_ywcrbp_sale_price', 'woocs_yith_ywcrbp_sale_price', 10, 2);
function woocs_yith_ywcrbp_sale_price($sale_price, $product) {
    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'];
                $sale_price = $sale_price * ($rate);
            }
        }
    }

    return $sale_price;
}

add_filter('yith_ywrbp_regular_price', 'woocs_yith_ywrbp_regular_price', 10, 2);
function woocs_yith_ywrbp_regular_price($regular_price, $product = NULL) {
    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'];
                $regular_price = $regular_price * ($rate);
            }
        }
    }

    return $regular_price;
}

//ywcrbp_product_replace_roleprices
add_filter('ywcrbp_product_replace_roleprices', 'woocs_ywcrbp_product_replace_roleprices', 9999, 4);
function woocs_ywcrbp_product_replace_roleprices($role_price, $user_role, $price, $product) {
    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'];
                $role_price = $role_price * ($rate);
            }
        }
    }

    return $role_price;
}

//yith_wcrbp_get_role_based_price   CART FIX
add_filter('yith_wcrbp_get_role_based_price', 'woocs_yith_wcrbp_get_role_based_price', 10, 2);
function woocs_yith_wcrbp_get_role_based_price($regular_price, $product) {

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

    return $regular_price;
}