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.

Our next available supporter will start replying to tickets in about 2.68 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

Tagged: 

This topic contains 17 replies, has 2 voices.

Last updated by hansN-10 2 months, 1 week ago.

Assisted by: Bruno Kos.

Author Posts
February 1, 2024 at 3:25 pm #15255655

hansN-10

Hello,

I am using WPML in my WooCommerce store.

In the emails that are being sent by WooCommerc (order confirmation, shipping confirmation etc.), sometimes the swedish word "Moms" does not get translated into the English word "VAT".

Please look at the attached screenshots:

In 1a, the word "Moms" has been correctly translated to "VAT"

In 2a, the word has not been translated, and remains as "Moms" even though the rest of the sentence has been translated into english.

Doing some testing, I believe this can reproduce the issue:

When processessing the order in the backend of WooCommerce, the orders status can be changed into "Processing" and "Completed".

This can be done at two different places in the backen.

Either in the order list (screenshot 1) or by clicking on the order in the order list, and then processing it in the new window that opens (screenshot 2).

My testing shows that when the order status is changed to Processing and/or Completed directly from the order list, the issue does NOT appear. The word Moms is being translated into english as it should.

But if the order status is being changed to Processing and/or Completed after opening up the specific order window, then the problem occurs. The word Moms does not get translated into VAT.

Is this a bug or should I change my settings in any way?

Thank you!

1.PNG
2.PNG
2a.PNG
1a.PNG
February 2, 2024 at 10:12 am #15258465

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

Can you check if this issue happens here?
hidden link

I believe I prepared everything for testing - if something else is needed by all means, please add/translate this email in the same way as it is done on your site.

Regards,
Bruno Kos

February 3, 2024 at 12:49 pm #15262058

hansN-10

Hi Bruno and thank you for your reply!

Can you please delete the WPML plugins from the test-site that you created, and then install WPML again. But please do not do any setup work, as I would like to go through the WPML setup wizard myself to get the same settings that I have on my live site.

Thank you!

Regards,
Hans

February 5, 2024 at 6:37 am #15264260

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

There is a reset button in the bottom of hidden link

But the WPML wizard is only about setting languages and translation options, you can change it all on hidden link, so no need to reset it and install anew.

February 7, 2024 at 1:42 pm #15276843

hansN-10

Thank you.

I have now begun setting up the test site.

When I did a test purchase in the woocommerce store, I did not receive any of the emails that I was expecting as the customer (email for "Order on hold", "Order being processed" and "Order completed").

Is there an email account connected to the test site, so that it can send out these emails?

Best regards,
Hans

February 7, 2024 at 1:48 pm #15276912

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

I installed hidden link, so all emails are now recorded here.

February 8, 2024 at 2:55 pm #15281860

hansN-10

Thank you, I believe that I have now been able to reproduce the issue.

Please look at the five different emails in the email log.

I have made a test order in the shop, which sends an automatic confirmation email to the customer and to the store owner. In these two emails, under "Total:", the word Swedish "Moms" has been translated into the English word "VAT".

But then I marked the order as Being Processed, then as Completd, and finally I marked the order as Partilly refunded.

All these three actions sends an automatic email to the customer.

If you look at the "Total:" section in these three emails, you can see that the Swedish word "Moms" has not been translated inte the English word "VAT".

How can I translate Moms to VAT in the Total-section of the emails?

Thank you.

February 12, 2024 at 7:18 am #15291072

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Thank you for the setup and examples - I am checking this with our 2nd tier and will keep you posted.

February 14, 2024 at 2:24 pm #15302932

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Can you try this?

In \WCML_Orders::is_order_action_triggered_for_customer in wp-content/plugins/woocommerce-multilingual/inc/class-wcml-orders.php replace the function with this one:

	private function is_order_action_triggered_for_customer() {
		return isset( $_GET['action'] ) && wpml_collect(
			[ 'woocommerce_mark_order_complete', 'woocommerce_mark_order_status', 'mark_processing', 'edit' ]
		)->contains( $_GET['action'] );
	}

in wp-content/plugins/woocommerce-multilingual/inc/class-wcml-orders.php in the method: \WCML_Orders::woocommerce_order_get_items add

			add_filter( 'woocommerce_rate_label', [ $this, 'translateLabelStringtest' ], 10, 2 );

just before:

			$this->adjust_order_item_in_language( $items, $language_to_filter );

Then add this code after the method \WCML_Orders::woocommerce_order_get_items

	private function getStringName( $taxId ) {
		return 'tax_label_' . $taxId;
	}
	const STRINGS_CONTEXT = 'admin_texts_woocommerce_tax';
	public function translateLabelStringtest( $label, $taxId ) {
		global $language_to_filter;
		$stringId = icl_get_string_id( $label, self::STRINGS_CONTEXT, $this->getStringName( $taxId ) );

		if ( ! $stringId ) {
			$this->migrateStringToTaxIdName( $taxId, $label );
		}

		return icl_translate( self::STRINGS_CONTEXT, $this->getStringName( $taxId ), $label, false ,$has_translation , $language_to_filter );
	}

Also change:

	public function woocommerce_order_get_items( $items, $order ) {

to

	public function woocommerce_order_get_items( $items, $order ) {
        global $language_to_filter;

I know these are quite a lot of changes, but the issue is coming from various sources and there is no easier workaround, but this ticket already escalated to our developers queue.

February 15, 2024 at 9:30 am #15305671

hansN-10

Hello and thank you for your response.

As the issue has been escalated, does that mean that there will be a fix in a future plugin-update?

In that case, I might wish to just wait for the update (and not do the suggested workaround), as it is a minor issue for me.

Or do you need me to try the workaround to see if it solves the issue on my site?

February 15, 2024 at 10:45 am #15306444

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

We are indeed working on a fix for the issue you've reported, and it will be included in one of the future plugin updates but I can't say when and which one.

If the issue is minor for you, waiting for the update is a good option. However, if you're willing to try the suggested workaround, your feedback would be valuable to us. It's not necessary, but it could help in ensuring the fix we're developing will be effective for all our users.

February 17, 2024 at 12:14 pm #15313682

hansN-10

Hello,

I tried doing the changes in the code on a staging site but it did not solve the issue.

But I am not good at working with code, so maybe I did something wrong.

As all the changes in the code were made to the same file (/woocommerce-multilingual/inc/class-wcml-orders.php), maybe you could send me the adjusted file, and I will swap the file on my site for the one you send me?

Thank you.

February 19, 2024 at 8:11 am #15316270

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Does it work at least for the customer email? Because our 2nd tier found out that this workaround will translate the string for the email, but for the admin it won't work and the admin email will still have the wrong translation.

February 19, 2024 at 1:06 pm #15318324

hansN-10

I believe that I did something wrong when trying to apply the changes to the code, so I have not been able to test how things work after changing the wpml code.

Would it be possible for you to send me the file where all the code changes were made? Then I can delete the original file on my staging site, and add the file that you send me.

After that I will be able to test how things work.

Thank you.

February 20, 2024 at 8:38 am #15320925

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Here is the updated file:
hidden link