Home Forums Plugins CURCY – WooCommerce Multi Currency Incorrect price calculation when placing an order

Incorrect price calculation when placing an order

  • Author
    Posts
  • #115665

    The store uses currency No. 1 (KZT), when placing an order, currency No. 2 (USD) is used.
    When I turn on the “Display multi currencies” setting, the value in the store’s currency is incorrectly calculated.

    1. If the beautiful price setting is enabled, then the rate is very heavily rounded due to the fact that a cost equal to “1” is supplied to determine it.

    	public function checkout_init() {
    		if ( ! $this->settings->get_param( 'equivalent_currency' ) ) {
    			return;
    		}
    		$current_currency   = $this->settings->get_current_currency();
    		$this->old_currency = $this->settings->getcookie( 'wmc_current_currency_old' );
    		if ( ! $this->old_currency || $this->old_currency == $current_currency ) {
    			return;
    		}
    
    		$rate1 = $current_currency !== $this->old_currency ? wmc_get_price( 1, $current_currency ) : '';
    
    		if ( $rate1 ) {
    			$rate2 = wmc_get_price( 1, $this->old_currency );
    			if ( $rate2 / $rate1 != 1 ) {
    				$this->rate = $rate2 / $rate1;
    			}
    		}
    	}

    2. The cost in KZT is calculated from USD and due to price rounding there is a mismatch between cents in KZT in the basket and when placing an order.

    3. Pretty price is not applied to calculated costs.

    Tell me, is it planned to fix this bug and how can I improve the code so that when placing an order, display the price of KZT the same as if the order was in KZT, and not in USD?

    Attachments:
    You must be logged in to view attached files.

You must be logged in to see replies to this topic. Click here to login or register