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 7 replies, has 3 voices.

Last updated by Dražen Duvnjak 5 months, 1 week ago.

Assigned support staff: Dražen Duvnjak.

Author Posts
March 1, 2022 at 2:39 pm #10687169

tomasA-11

I am trying out WPML so see if this in a option for us.
We have tried it for a couple of years ago and then it was to slow, performance was bad.
But now with never versions we want to test again.
We have 50.0000 products...
So we really need it to work this way:
We only translate name and description on the product, and if we want more info.
But if we don't add "translated" images WPML should take image, price etc from original product.

We have done the settings that Media (attachment) and product should fallback to default language but it don't work.
If translate a product and only change title and description, the images from original product is not shown.
So I guess this function is buggy? Or should we do something more for this to work?

March 1, 2022 at 3:45 pm #10687885

Laura
Supporter

Languages: English (English ) Italian (Italiano )

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

Hi,

thanks for contacting us.

Before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

I'm not sure what do you mean with "translated images". Media is usually copied when you translate a product.

I can see you set attachment on "fallback to the default language". You shouldn't use this option with Media, there's a reason why the post type is locked by default. Probably changing this setting altered the correct behavior of WPML.

Please set back attachment as "do not translate" and see if you still have the issue. If you do, please explain us in details your process for translating, possibly adding some screenshots.

March 1, 2022 at 4:08 pm #10688293

tomasA-11

Hi, I changed back media to "do not translate".
No difference.

Media does not show up at product, the fallback on price does not work either.
To be able to translate all 50 000 product I have made a script that create a translation and sets Title and description, the rest of the values I want the translated products to take from original product.

wpml no fallback.png
wpml.png
March 2, 2022 at 9:20 am #10694281

Dražen Duvnjak
Supporter

Languages: English (English )

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

Hello,

thanks for getting back.

I have checked your original description of the ticket and your last reply, I am afraid that is not how WPML works and something like that is not possible without some additional custom coding.

The closes thing WPML has is "Display as translated", which if the product is not translated shows the default language product info.

- https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/

What you have described is a lot more complex situation, and I can see you are doing so (translations) using some custom code. Which then should be adapted further where code should check default language data and if not there then add/copy it from the default language. This would require some further adapting in the order for it to work correctly.

I am afraid as per our policy we can not support/debug your custom code nor provide custom-coded solutions for you.

Support policy:

- https://wpml.org/purchase/support-policy/

We’ll answer any doubt and help you with any question related to WPML etc. but we cannot support or produce custom code solutions for you. When you need custom coding which extends WPML functionality, we recommend using our WPML certified contractors system.

- https://wpml.org/contractors/

Hope you will understand and I was a bit helpful.

Kind regards,
Drazen

March 2, 2022 at 2:08 pm #10698389

tomasA-11

So, we have over 50.000 products.
We have translated title and descriptions for them them in three languages, have them available with post id and sku on the original product.

How do we automatically add translations to three languages to all 50 000 products?
Everything should be the same as the original product only title and descriptions changed.

March 2, 2022 at 2:37 pm #10698773

Dražen Duvnjak
Supporter

Languages: English (English )

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

Hello,

there are a few approaches on how can you translate in a bulk many numbers of products:

1) Use WPMLs automatic translation and bulk translation if that works for you:

- https://wpml.org/documentation/automatic-translation/
- https://wpml.org/documentation/automatic-translation/automatically-translating-multiple-translation-jobs-in-bulk/

2) Duplicate products to 2nd language and then just change and adjust title/description. You can do so via WPMLs duplicate option or using our hooks as noted here: https://wpml.org/wpml-hook/wpml_admin_make_post_duplicates/

3) This is an option I suggest you try as would probably be most helpful and closest to what you need, using WooCommerce REST API to translate your products. With a little bit of custom code, you can specify there / fetch price field value and translate only the title/description.

I am not 100% sure on this since I haven't tested it, but you can also try and not specify a price for translation, only title, and description and it might work since the WooCommerce price field is set to COPY by default and probably will be copied on translation.

Please check next documentation and related WooCommerce docs:

- https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/
- https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/#create-products
- hidden link

I hope I was helpful.

Regards,
Drazen

Screenshot_3.jpg
March 3, 2022 at 10:08 am #10704807

tomasA-11

Many thanks for you help Drazen and Laura.
I have made a script that is solving the products now, I use the code I have in the picture below and have added to copy the post_meta from the original product that I want to copy. Seems to work fine.

Now to the Product Categories, is there a way to automate this translation as well?
It's the same here I have translations, and I have ID:s so that I can connect my translation to the original product category.

March 3, 2022 at 12:55 pm #10706661

Dražen Duvnjak
Supporter

Languages: English (English )

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

Hello,

thanks for getting back.

Glad to hear you managed to get it working. 🙂

As for categories, you should connect them with correct info in a database, (icl_translations table), please check on how our database tables are configured:

- https://wpml.org/documentation/support/wpml-tables/

You can use the next hooks for the suggested approach:

- https://wpml.org/wpml-hook/wpml_element_trid/
- https://wpml.org/wpml-hook/wpml_get_element_translations/
- https://wpml.org/wpml-hook/wpml_set_element_language_details/

Similar example code from older ticket:

- https://wpml.org/forums/topic/how-to-insert-custom-taxonomy-terms-in-multiple-languages-programmatic-ally/#post-5952441

How I was helpful.

Regards,
Drazen