• Hi,
    I am looking for solution to have two currencies on backend. I mean to show default currency details as well as changed one.

    I have premium version of plugin. My main currency is USD and in this currency I would like to send invoices to clients but I need more information in USD.
    When somebody buy product in different currency e.g. AED Woocommerce > Orders show details in AED, also I receive email – new order in AED.

    I wonder if can I show still main currency in brackets as on attachments. Both places (orders, email) would be perfect, but important place for me is email.

    I have to replace: woocommerce/templates/email/admin-new-order.php
    But I dunno get those information in php.

    do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );

    I have to edit $order somehow.

    I hope I was clear enough.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Lukasz Matysiewicz

    (@donbebeno)

    Looks like topic is back after 5 months, and it’s marked as resolved. Well when someone is doing invoice for order need to put all details in currency not just total i.e. tax, shipping, vat
    https://www.ads-software.com/support/topic/how-to-get-always-the-main-currency-in-the-backend/

    I put request in premium support on https://villatheme.com how much it would cost to add this solution. And after I was ignored. I decided to have a look by my own.

    First idea was to overwrite wordpress>includes>admin>html-order-item. i.e.

    // echo wc_price $wmc_order_base_currency;
    echo wc_price( wc_round_tax_total( $tax_item_total ), array( 'currency' => $order->get_currency() ) );

    but I am not sure which global variable can I use to both currencies. $wmc_order_base_currency?

    Secondly I had a look into plugin. I found this function. Can’t it be modified and used in order-item.php not just order-items.php

    	public function order_total_in_base_currency( $col ) {
    		global $post, $the_order;
    
    		if ( $col == 'order_total' ) {
    			if ( empty( $the_order ) || $the_order->get_id() !== $post->ID ) {
    				$the_order = wc_get_order( $post->ID );
    			}
    			$order_currency = get_post_meta( $post->ID, '_order_currency', true );
    			$wmc_order_info = get_post_meta( $post->ID, 'wmc_order_info', true );
    			if ( is_array( $wmc_order_info ) && count( $wmc_order_info ) ) {
    				foreach ( $wmc_order_info as $code => $currency_info ) {
    					if ( isset( $currency_info['is_main'] ) && $currency_info['is_main'] == 1 && isset( $wmc_order_info[ $order_currency ] ) ) {
    						if ( $order_currency != $code && floatval( $wmc_order_info[ $order_currency ]['rate'] ) ) {
    							$price_in_base_currency = ( $the_order->get_total() - $the_order->get_total_refunded() ) / $wmc_order_info[ $order_currency ]['rate'];
    							?>
                                <p style="color:red">
    								<?php echo $code . ': ' ?>
                                    <span>
                                        <?php echo wc_price( $price_in_base_currency, array(
    	                                    'currency' => $code,
    	                                    'decimals' => ! empty( $wmc_order_info[ $code ]['decimals'] ) ? (int) $wmc_order_info[ $code ]['decimals'] : 0
                                        ) ) ?>
                                    </span>
                                </p>
    							<?php
    						}
    						break;
    					}
    				}
    			}
    
    		}
    	}

    I think similar function could work in there.
    That’s a process so far. I will try back if I find something how to solve this.

    Plugin Support angelagrey

    (@angelagrey)

    Hi,

    Thank you for reaching out to us.

    I’m sorry for this delay reply. We’ve received your ticket on our Support Forum and replied right away back then: https://villatheme.com/supports/topic/show-two-currencies-in-backend/#post-151689

    Please keep us updated via the topic and the custom work request.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show two currencies in Backend’ is closed to new replies.