Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 36 replies, has 2 voices.

Last updated by rufusB 1 year, 2 months ago.

Assigned support staff: Yvette.

Author Posts
October 24, 2019 at 1:59 pm #4821007

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Los_Angeles (GMT-08:00)

I´ve found the strings in a recent version of WCML. I am preparing an escalation ticet to move this to 2nd tier support. Sorry this is taking so long to resolve.

October 24, 2019 at 2:47 pm #4821377

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Los_Angeles (GMT-08:00)

I´ve escalated this ticket to you 2nd tier support group.
I just thought I´d point out that I don´t think it is a currency conversion issue, but rather one of the wrong product variation being sent to the gateway.

7,50GBP corresponds to the variation of format = mp3.
So, it looks like the gateway is being sent the wrong product variation for pricing.

In any case, 2nd tier will be taking a closer look at this,.

November 8, 2019 at 8:29 am #4911305

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Los_Angeles (GMT-08:00)

Hello

I have a workaround from our 2nd tier group.

Please replace the following code from this file:
wp-content/plugins/woocommerce-multilingual/inc/class-wcml-cart.php
in the function:
get_cart_total_in_currency()

change:

//items total
		foreach( $cart_items as $item ){
			$cart_total += $this->woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $item['product_id'], $currency ) * $item['quantity'];
		}

to this:

foreach( $cart_items as $item ){
			if (isset($item['variation_id']) ){
				$cart_total += $this->woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $item['variation_id'], $currency ) * $item['quantity'];
			}
			else {
				$cart_total += $this->woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $item['product_id'], $currency ) * $item['quantity'];
			}
		}

The problem has been identified to our code reading the wrong meta-data. I wait for your confirmation if this works. The issue has been escalated to our development team and they will include the patch in a future release

November 8, 2019 at 9:44 am #4911893

rufusB

Hi, thanks for that, like the new photo 😉

I don't have that code in the file section to replace. Could it be related to the update? Currency options were disabled for some time but they were active when I copied the code below. What I find is this-

public function get_cart_total_in_currency( $currency ){

$client_currency = $this->woocommerce_wpml->multi_currency->get_client_currency();
$cart_total = 0;
$cart_items = WC()->cart->get_cart_contents();

//items total
foreach( $cart_items as $item ){
$cart_total += $this->woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $item['product_id'], $currency ) * $item['quantity'];
}

$cart_total += $this->woocommerce_wpml->multi_currency->prices->convert_price_amount_by_currencies( WC()->cart->get_shipping_total(), $client_currency, $currency );

$cart_total = $this->woocommerce_wpml->multi_currency->prices->apply_rounding_rules( $cart_total, $currency );

return $cart_total;
}

November 8, 2019 at 4:27 pm #4914885

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Los_Angeles (GMT-08:00)

Oh - I see on the cloudway server that indeed your WCML version is quite old. Yes .- the code is in the newest versions of our releases.
I´ve updated all the plugins on the server that I could and also updated the code (see image).

Then I executed the following steps - it seems to be working.
Please confirm there!

1. Visit this page and load product into basket in GBP
hidden link

2. Notice the price is: 10.00GBP (we expect this to be the price to pay in GBP)
3. Remove from cart and add the same product again in EUR. Cart total should read 11.20 EURO
4. Proceed to checkout
Scroll down to payment methods. See the text "Please note that the payment will be made in GBP. £10.00 will be debited from your account."

This used to have the price of the other variation. Now it is correct.

So, you can now decide when and how to upgrade your live system. You can also use this moment to check that there are no other surprises involved with upgrading.

PS. Thanks for the compliment on the new gravatar! = )

November 13, 2019 at 9:32 pm #4942919

rufusB

My issue is resolved now. Thank you!

November 21, 2019 at 1:45 pm #4988611

rufusB

one more thing, could you please delete the duplicate site from cloudways, it is sending duplicate notifications of orders. Thanks