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 thread is resolved. Here is a description of the problem and solution.

Problem: How to change the original English WooCommerce strings? Solution: The correct way to perform this is to use template overrides in a child theme. Once you add new strings in the template overrides, you need to perform a theme scan for new strings from WPML -> Theme and plugins localization Relevant Documentation: https://docs.woocommerce.com/document/template-structure/#section-1 https://codex.wordpress.org/Child_Themes

This topic contains 4 replies, has 2 voices.

Last updated by andrewB-17 11 months, 4 weeks ago.

Assigned support staff: Vincenzo.

Author Posts
October 14, 2018 at 10:57 am

andrewB-17

Hi, On this bilingual English/Japanese site using WPML with Woocommerce installed:
tokyopicnics.com
I’ve been trying to change 4 parts on the Woocommerce Checkout page (hidden link):
Billing Details, Additional information, PRODUCT, QUANTITY.
from English to English using Locotranslate.

2 of them I could translate but 2 of them wouldn’t so I asked this support on Oct 6th:

“Is it possible to translate those 4 parts from site's main language (English) to English using WPML?”
I got an answer from Diego Pereira:

“Unfortunately, WPML needs to disable Loco Translate's functionality in order to function normally.
There is a workaround you can try to change a hardcoded string without changing it in the theme's actual code.
To do this, please go to WPML >Languages > Add new language -> and add a random language. Then scroll down to Hide languages and hide this new language.
Now go to WPML > String Translation, Select your string then click on Change language of selected string. Select the new created language.
Now, if you click on translations will have an option to "translate" it on the original language of the theme.
Please let me know if it worked for you”.

I managed to do it with code in functions.php in a Child theme and closed the ticket but after a few days for some reason that code is slowing the site down a lot so I had to try Diego's answer.

I deleted Locotranslate and used the random language as German and selected string as Woocommerce but the changes don’t appear.

The English I want also shows highlighted in yellow (maybe from previous attempts). See screenshot for Billing details change to Reservation details.

Thanks!

October 16, 2018 at 9:57 am #2820439

Vincenzo
Supporter

Languages: English (English ) Italian (Italiano )

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

Hello, thank you for contacting WPML Support!

The correct way to perform what you need is to use template overrides in a child theme.
See: https://docs.woocommerce.com/document/template-structure/#section-1
https://codex.wordpress.org/Child_Themes

You just need to copy the related WooCommerce template into a directory within your active theme named /woocommerce keeping the same file structure but removing the /templates/ subdirectory.

Once you copied it, you need to edit the template to change the original strings.

When a string is highlighted in yellow, it means that the translation was taken from the available .mo language files.
In that case, you need to edit it only if you wish to change it.

Please let me know if this solves the issue or if you need further details.

Thank you

October 21, 2018 at 8:54 am #2835280

andrewB-17

Hi Vincenzo, Thanks. I did as you suggested and used template overrides in a child theme (foddy-child). (Screen Shot 1)

I managed to change 3 of the 4 texts on the English site.

Can you help with 2 more things?

1. The new English text I changed overrides the Japanese text on the Japanese site (Screen Shot 2). How can I keep the original Woocommerce Japanese text or change it to my preferred text?

2. On review-order.php I could change the coding for PRODUCT to PLAN (Screen Shot 3) but can’t find where to change QUANTITY to NO. OF GUESTS (Screen Shot 4). Do you know how or where can I change that?

Thanks!

October 22, 2018 at 7:18 pm #2839654

Vincenzo
Supporter

Languages: English (English ) Italian (Italiano )

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

Hello,

I'm glad to know that the issue is getting solved.

1. For question number 1, try these steps:
- Go to WPML -> Theme and plugins localization
- Scroll down to the section called "Strings in the themes"
- Select the current child theme
- Press the "Scan selected themes for strings" button
- Wait for the scan to finish
- Go to WPML -> String Translation
- Search and translate the following strings:
- Special requests
- Reservation details

2. For question number 2, I think the QUANTITY string may be added with a hook.
See: https://www.remicorson.com/how-to-customize-the-woocommerce-checkout-page/

You can ask for help to the theme support.

Alternatively, you can try the snippet shown on this page:
https://businessbloomer.com/translate-single-string-woocommerce-wordpress/

Best regards,
Vincenzo

October 23, 2018 at 12:27 am #2840083

andrewB-17

Hi Vincenzo, No. 1 worked.
No.2 also worked using the snippet from business bloomer.

My issue is resolved now. Thank you very much for your help!