PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Currency Converter Filter

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

I want that currency converter do not apply on shipping charges.

I need to clarify what you're trying to achieve. If currency converter doesn't apply to shipping charges, this creates a problem:

Example:

  • Product price: 100 AED (converted to EUR)
  • Shipping: 20 AED (NOT converted, stays AED)
  • Customer pays in EUR at checkout
  • Payment gateway receives mixed currencies → transaction will fail

Possible solutions:

  1. Enable"Is multiple allowed" in WOOCS settings - customer always pays in ONE fixed currency (base currency), only product prices are displayed in converted currency. This way shipping stays consistent.
  2. All prices convert together (recommended) - both products AND shipping convert to the same currency, so checkout works properly.

Could you clarify exactly what you need? Are you trying to:

  • Keep shipping costs fixed in base currency for accounting?
  • Show different currencies for products vs shipping (this won't work with payment gateways)?
  • Something else?

Please describe your complete checkout flow so I can suggest the right solution.

Basically I am using a double exchange rate for my prodcut prices, like is the price is 1 rupee then in dollars it will be double, and if someone out of india he will he price in dollars. But as the price double the freight/shipping charges also get double. But I want it to be exactly what I set even if some one see it out side from India. And if I make it half just to cover the exchange rate I set then it there is aother issue. If someone in use indian vpn from outside the india then the shipping rate he will see will be half, same for someone who is living in india and want to send the books outside of india

Are you there?

 

Hello

Read this please: https://pluginus.net/support-conditions/

I can suggest you way how you can get it, use woocommerce hook woocommerce_package_rates, manipulate with shipping data by your business, logic, here is code example:

add_filter('woocommerce_package_rates', function($rates) {
    if (!class_exists('WOOCS')) {
        return $rates;
    }
    
    global $WOOCS;
    $current_currency = $WOOCS->current_currency;
    $base_currency = get_option('woocs_default_currency', 'INR');
    
    // If not base currency, convert shipping back to base currency amount
    if ($current_currency != $base_currency) {
        $currencies = $WOOCS->get_currencies();
        $rate = floatval($currencies[$current_currency]['rate']);
        
        foreach ($rates as $rate_key => $shipping_rate) {
            // Divide by WOOCS rate to get back to base currency value
            $rates[$rate_key]->cost = floatval($shipping_rate->cost) / $rate;
            
            if (!empty($shipping_rate->taxes)) {
                foreach ($shipping_rate->taxes as $tax_key => $tax) {
                    $rates[$rate_key]->taxes[$tax_key] = $tax / $rate;
                }
            }
        }
    }
    
    return $rates;
}, 9999, 1);

 

 

 

I do not know about coding, and you give me the eaxact solution?

Hello

I've proposed a solution to your business problem. If you don't understand how to implement it, you should hire a developer.

I have pasted this code but it showing the shipping charges 150$ instead of 3.30$

Hi

In this case try next code:

add_filter('woocommerce_package_rates', function($rates) {
    if (!class_exists('WOOCS')) {
        return $rates;
    }
    
    global $WOOCS;
    $current_currency = $WOOCS->current_currency;
    $base_currency = $WOOCS->default_currency;  // chnaged here
    
    if ($current_currency != $base_currency) {
        $currencies = $WOOCS->get_currencies();
        $base_rate = floatval($currencies[$base_currency]['rate']); 
        $current_rate = floatval($currencies[$current_currency]['rate']);
        
        // Calculate conversion factor to reverse WOOCS conversion
        $factor = $base_rate / $current_rate;  // ← НОВОЕ: ratio вместо просто rate
        
        foreach ($rates as $rate_key => $shipping_rate) {
            $rates[$rate_key]->cost = floatval($shipping_rate->cost) / $factor;  // ← Divides by factor, not rate
            
            if (!empty($shipping_rate->taxes)) {
                foreach ($shipping_rate->taxes as $tax_key => $tax) {
                    $rates[$rate_key]->taxes[$tax_key] = $tax / $factor;
                }
            }
        }
    }
    
    return $rates;
}, 9999, 1);