WOOCS - WooCommerce Currency Switcher

WooCommerce Product Add-Ons Ultimate by pluginrepublic.com

Plugin link: https://pluginrepublic.com/wordpress-plugins/woocommerce-product-add-ons-ultimate/

In file plugins\product-extras-for-woocommerce\inc\functions-cart.php add next code:

if (class_exists('WOOCS')) {
    global $WOOCS;
    if ($WOOCS->is_multiple_allowed) {
        $price = $WOOCS->woocs_exchange_value(floatval($price));
    }
}

 

On the same file add next code:

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

 

 

And to the same file:

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

And on the same file:

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'];
            $cart_item_data['product_extras']['price_with_extras_discounted'] = $cart_item_data['product_extras']['price_with_extras_discounted'] / $rate;
        }
    }
}

 

And on the same file:

if (class_exists('WOOCS') AND $item['price']) {
    global $WOOCS;
    if ($WOOCS->is_multiple_allowed) {
        $currrent = $WOOCS->current_currency;
        if ($currrent != $WOOCS->default_currency) {
            $currencies = $WOOCS->get_currencies();
            $rate = $currencies[$currrent]['rate'];
            $item['price'] = $rate * $item['price'];
        }
    }
    $item['value'] = preg_replace('/\((.+)\)/', "", $item['value']);
    $item['value'] .= sanitize_text_field("(" . wc_price($item['price']) . ")");
}