Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter askbahar


    Ok, I got the issue. It seems that price was converted twice, first before adding into cart, and then inside cart page.

    I have fixed the problem with a simple hack 🙂

    //We are reversing the price of product to USD in cart page, because the rate is applied again there
    add_action('woocommerce_before_calculate_totals', 'fix_currency_conversion');
    function fix_currency_conversion($cart_object){
                global $WOOCS;
                $cur_currency = $WOOCS->current_currency;
                $currencies = $WOOCS->get_currencies();
                $conversion_rate = $currencies[$WOOCS->current_currency]['rate'];
                if($cur_currency == 'HKD'){
                    foreach ( $cart_object->cart_contents as $cart_item_key => $cart_item ) {
                        $cart_item['data']->price = $cart_item['data']->price / $conversion_rate;
    Plugin Author RealMag777


    Great! Thank you 😉



    If I’m using multiple currency options do I need to use this code once for each currency or can i modify this code for each currency?

    Plugin Author RealMag777


    Use it as you want in your functions.php

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Currency conversion is wrong in Cart page’ is closed to new replies.