Home Support Themes ExpertHive Show the currency by which the order payment has been made

Show the currency by which the order payment has been made

  • Author
    Posts
  • iktaweb

    Hello guys,

    I’m integrating a multicurrency support for the ExpertHive theme and I would like to display the order total price depending on the currency by which the order has been made in the “Received Orders” section of the vendors.
    e.g: a client paid the order with 29€, but in the Received Orders list it shows 29CHF because CHF is the main currency.

    the file hivepress\order\edit\block\order-total.php uses the following code but it shows the total with the main currency not the currency by which the order has been paid:

    <td class="hp-order__total">
    	<span><?php echo esc_html( $order->display_total() ); ?></span>
    </td>

    I tried the following code, it works but it’s not a good practice as it makes an SQL query on each order inside the loop:

    <td class="hp-order__total">
        <span>
            <?php 
                $order = wc_get_order($order->get_id());
                echo $order->get_order_item_totals()['order_total']['value'];
            ?>
        </span>
    </td>

    Any idea how to do this ?

    Thanks a lot.

    ihor developer

    Hi,

    The Received Order page is rendered by WooCommerce plugin, you can try overriding the WooCommerce template part instead (for example the part that renders order totals). You can also try using some existing currency switcher extension for WooCommerce (like this one https://wordpress.org/plugins/woocommerce-currency-switcher/) but it may require integration with ExpertHive.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.