WOOCS - WooCommerce Currency Switcher

Fancy Product Designer

Plugin linkhttps://codecanyon.net/item/fancy-product-designer-woocommercewordpress/6318393

In file \wp-content\plugins\fancyproductdesigner\inc\class-frontend.php add next code:

var price = fancyProductDesigner.calculatePrice();
if (woocs_current_currency != 'undefined' && woocs_current_currency['rate'] != 'undefined')
    {
     var dec = 1;
     if (woocs_current_currency['decimals']) {
        dec = Math.pow(10, woocs_current_currency['decimals']);
    }
    price = Math.round(price * woocs_current_currency['rate'] * dec) / dec;

}

Add next code in the same file:

if (class_exists('WOOCS')) {
    global $WOOCS;
    $currencies = $WOOCS->get_currencies();
    $cur_cur = $WOOCS->current_currency;
    if ($cur_cur != $WOOCS->default_currency) {
        $sign = $currencies[$cur_cur]['symbol'];
        switch ($currencies[$cur_cur]['position']) {
            case 'right':
            case 'right_space':
                $price_format = "%d" . $sign;
                break;
            case 'left':
            case 'left_space':
            default:
                $price_format = $sign . "%d";
        }
    }
}


In file \wp-content\plugins\fancy-product-designer\inc\api\class-product-settings.php add next code:

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


In file \wp-content\plugins\fancy-product-designer\inc\api\class-product-settings.php add next code:

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

In file wp-content\plugins\fancy-product-designer\woo\class-wc-cart.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'];
            $_POST['fpd_product_price'] = $_POST['fpd_product_price'] / $rate;
        }
    }
}