FOX - Currency Switcher Professional for WooCommerce

Role Based Price For WooCommerce

Plugin link: https://wordpress.org/plugins/woocommerce-role-based-price/

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

add_filter("wc_rbp_product_get_price", function($wcrbp_price, $product, $rbp_this) {

    if (class_exists('WOOCS')) {

        $sale_price = $product->get_sale_price();

        global $WOOCS;
        if ($WOOCS->is_multiple_allowed AND ( $sale_price !== '' && $sale_price > 0 )) {
            $currrent = $WOOCS->current_currency;
            if ($currrent != $WOOCS->default_currency) {
                $currencies = $WOOCS->get_currencies();
                $rate = $currencies[$currrent]['rate'];
                $wcrbp_price = $wcrbp_price / $rate;
            }
        }
    }
    return $wcrbp_price;
}, 99, 3);

 

In file wp-content\plugins\woocommerce-role-based-price\includes\class-product-pricing.php add next code:

if (class_exists('WOOCS')) {
    global $WOOCS;
    if ($WOOCS->is_multiple_allowed) {
        $prices['min_price'] = $WOOCS->woocs_exchange_value(floatval($prices['min_price']));
        $prices['max_price'] = $WOOCS->woocs_exchange_value(floatval($prices['max_price']));
        $prices['min_reg_price'] = $WOOCS->woocs_exchange_value(floatval($prices['min_reg_price']));
        $prices['max_reg_price'] = $WOOCS->woocs_exchange_value(floatval($prices['max_reg_price']));
    }
}


In file \wp-content\plugins\woocommerce-role-based-price\includes\class-product-pricing.php change code:

if( $is_hook == TRUE OR (class_exists('WOOCS') AND defined( 'DOING_AJAX' )) ) {


Note: unfortunately this does not work with option “I am using cache plugin on my site