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

Multiple Currencies is ruining my revenue insights

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.

Customers have the option to checkout in either CAD or USD. USD being the base currency for my website.

The only issue is that my website insights have no idea what currency is being used so when it gives me my daily, weekly or monthly revenue, its just a big sum of all currencies. It is extremely inaccurate now.

Is there a way this can be fixed so that my insights are all in my base currency of USD?

 

I don't want to force all customers to be charged in USD because my website used to be that way and I got TONS of pushback from Canadian customers

 

Hello

I can suggest you order recalculation to basic currency: https://share.pluginus.net/image/i20251107121936.png

Will I have to do this for every single order I receive? Is there a code snippet to do it automatically?

 

Basically it is possible to do by functions:

$woocs = new WOOCS();
$woocs->recalculate_order(515, 'EUR');

If you need snippet you can ask AI, here is an example:

add_action('wp', 'schedule_order_currency_conversion');

function schedule_order_currency_conversion() {
if (!wp_next_scheduled('convert_orders_to_base_currency')) {
// Run daily at 3 AM
wp_schedule_event(time(), 'daily', 'convert_orders_to_base_currency');
}
}

// Hook the conversion function
add_action('convert_orders_to_base_currency', 'convert_all_orders_to_base_currency');

function convert_all_orders_to_base_currency() {
if (class_exists('WOOCS')) {
$woocs = new WOOCS();
$base_currency = 'USD';

// Get all orders that are NOT in base currency
$args = array(
'limit' => -1,
'status' => array('wc-completed', 'wc-processing', 'wc-on-hold'),
'meta_query' => array(
array(
'key' => '_order_currency',
'value' => $base_currency,
'compare' => '!='
)
)
);

$orders = wc_get_orders($args);
foreach ($orders as $order) {
$order_id = $order->get_id();
$order_currency = $order->get_currency();

// Skip if already in base currency
if ($order_currency === $base_currency) {
continue;
}

// Store original values before conversion
$order->update_meta_data('_original_currency', $order_currency);
$order->update_meta_data('_original_total', $order->get_total());
$order->update_meta_data('_conversion_date', current_time('mysql'));
$order->save();

// Convert order to base currency
$woocs->recalculate_order($order_id, $base_currency);
}
}
}

// Deactivation hook to clear scheduled event
register_deactivation_hook(__FILE__, 'deactivate_currency_conversion_cron');

function deactivate_currency_conversion_cron() {
$timestamp = wp_next_scheduled('convert_orders_to_base_currency');
wp_unschedule_event($timestamp, 'convert_orders_to_base_currency');
}

Hi,

Will the snippet you posted here work without modifications?

If not, I will try to get AI to fix it.

 

 

FYI for anyone else reading this, be careful, I tried to get AI to write me a code snipper before making this post and it completely broke my website!

Hello Tony

You askeed, I suggested, and as described code is generated by AI Clode

What is main code in this history is:

$woocs = new WOOCS();
$woocs->recalculate_order($order_id, $currency);

All another automatization side is on your side