• Resolved mklusak

    (@mklusak)


    How can I get (programmatically) Woocommerce order total in shop default currency? I have a shop with two currencies – CZK (default) and EUR. If someone makes an EUR order, how can I get its CZK value? I need it for custom ecommerce tracking script.

    I tought this code will work, but no.

    
    $order = wc_get_order( $order_id );
    $currency_code = $order->get_order_currency();
    $order_total = $order->get_total();
    
    if( $currency_code != 'CZK' ) { // == EUR
    	$order_total = wmc_get_price( $order_total, 'CZK' ); // $order_total is EUR amount
    	// useless - CZK "rate" is 1 (= default currency)
    	// ... so $order_total * 1 does nothing (in wmc_get_price function)
    }
    

    Is there any way how to simply calculate betweeen shop currencies?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can’t get order total in shop default currency?’ is closed to new replies.