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

CURRENCIES and REPPORT

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.

Hello Support Team,

I am considering purchasing the FOX Currency Switcher Professional for WooCommerce, but I have a critical question regarding sales reporting:

Our store's Base Currency is USD, but we allow customers to pay in their selected currency (e.g., AUD via Klarna).

The built-in WooCommerce sales reports aggregate all order totals and assume they are in the base currency, which inflates our total revenue numbers.

My question is: Does the FOX plugin automatically solve this problem by:

Converting the foreign order total (e.g., the AUD amount) to the Base Currency equivalent (USD) using the historical exchange rate saved on the order?

Replacing or filtering the native WooCommerce Sales Report data so the total daily/monthly revenue figure shown is the accurate, non-inflated USD value?

In short, when I look at the main WooCommerce Analytics dashboard, will the"Total Revenue" reflect the true USD value of all foreign currency transactions?

If not, please let me know which specific module or add-on is required to achieve this accurate base currency conversion in the main reports.

Thank you for your help!

Hello

Yes, FOX can solve this issue! The plugin saves the exchange rate with each order, but WooCommerce Analytics doesn't automatically use it.

Solution:

Add this code to your theme's functions.php file (or use a custom plugin like Code Snippets):

/**
 * FOX - Convert foreign currency orders to base currency in WooCommerce Analytics
 * Add this code to your theme's functions.php or a custom plugin
 */

// Disable Analytics cache to ensure real-time conversion
add_filter('woocommerce_analytics_enable_cache', '__return_false');

// Convert order totals to base currency in Analytics reports
add_filter('woocommerce_analytics_orders_select_query', function ($results, $args) {
    if (!$results || !isset($results->data) || empty($results->data)) {
        return $results;
    }
    
    $base_currency = get_woocommerce_currency();
    
    foreach ($results->data as $key => $order_data) {
        $order_id = $order_data['order_id'];
        $order_currency = get_post_meta($order_id, '_order_currency', true);
        
        // Only convert if order currency differs from base currency
        if ($order_currency && $order_currency !== $base_currency) {
            // Try to get the historical exchange rate from order meta
            $exchange_rate = get_post_meta($order_id, '_woocs_order_rate', true);
            
            // Fallback to current rate if historical rate not found
            if (!$exchange_rate) {
                $exchange_rate = woocs_get_exchange_rate($order_currency, $base_currency);
            }
            
            // Convert all monetary values to base currency
            if ($exchange_rate && $exchange_rate > 0) {
                if (isset($order_data['net_total'])) {
                    $results->data[$key]['net_total'] = floatval($order_data['net_total']) * floatval($exchange_rate);
                }
                if (isset($order_data['total_sales'])) {
                    $results->data[$key]['total_sales'] = floatval($order_data['total_sales']) * floatval($exchange_rate);
                }
                if (isset($order_data['tax_total'])) {
                    $results->data[$key]['tax_total'] = floatval($order_data['tax_total']) * floatval($exchange_rate);
                }
                if (isset($order_data['shipping_total'])) {
                    $results->data[$key]['shipping_total'] = floatval($order_data['shipping_total']) * floatval($exchange_rate);
                }
            }
        }
    }
    
    return $results;
}, 10, 2);

/**
 * Helper function to get exchange rate between two currencies
 */
function woocs_get_exchange_rate($from_currency, $to_currency) {
    global $WOOCS;
    
    if (!isset($WOOCS) || !$WOOCS) {
        return 1;
    }
    
    $currencies = $WOOCS->get_currencies();
    
    if (isset($currencies[$from_currency]) && isset($currencies[$to_currency])) {
        $from_rate = floatval($currencies[$from_currency]['rate']);
        $to_rate = floatval($currencies[$to_currency]['rate']);
        
        if ($from_rate > 0) {
            return $to_rate / $from_rate;
        }
    }
    
    return 1;
}

Ответ клиенту:

What this does:

  • Converts all foreign currency orders to your base currency (USD) in real-time
  • Uses the historical exchange rate saved at the time of purchase
  • Updates all Analytics reports: Total Revenue, Net Sales, Taxes, Shipping
  • Works with WooCommerce Analytics dashboard

After adding the code:

  1. Clear your browser cache
  2. Refresh the WooCommerce Analytics page
  3. Your"Total Revenue" will now show accurate USD values

Note: The code disables Analytics cache to ensure real-time conversion. If you have a large store, you may want to enable caching after verifying everything works correctly.

Let me know if you need any adjustments!