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: Composite Product component translations are lost when saving original

Solution: Setting the _bto_data to "Don't Translate" solved the issue.

This topic contains 10 replies, has 2 voices.

Last updated by George L. 1 month ago.

Assigned support staff: Shekhar Bhandari.

Author Posts
September 17, 2019 at 4:35 pm #4590127

George L.

Saving a composite product on the original language removes any translations on the components.

Steps to reproduce
1. Create a new simple product
2. Create a new composite product
3. Add a new component and select the simple product
4. Translate the composite product using WPML's translator editor
5. Check the composite product in both languages. Everything is fine so far
6. Make a small change on the component, (for example change the discount amount)
7. Check the translation on the front end - The translated text is now gone

Small changes shouldn't affect the translation. The "copy" option should not blindly overwrite the options on the translation and create new IDs for the components

note: Set the _bto_data to "copy"

p.s. I cannot provide a duplicator copy or backup or FTP access. The issue can be reproduced on a vanilla installation

September 17, 2019 at 4:45 pm #4590279

George L.

I've uploaded the latest version of composite products on the staging you gave me

September 19, 2019 at 5:40 am #4601459

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

I am taking care of this ticket from now-on.

I followed the same steps as you mentioned on the sandbox site but couldn't reproduce the problem, so can you please cross-check once if I did the correct thing?
hidden link

I created a composite product, translate it as mentioned and updated the discount % and there is no change in translation for secondary language.

Look forward to your reply.

Thanks

September 19, 2019 at 6:39 am #4601677

George L.

Hi Shekhar,

The _bto_data was set to "Don't translate".

I've now set this to "Copy" so you can try again.

September 19, 2019 at 6:56 am #4601727

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Yes, no I can see the issue.

Just a quick question, since you have found the workaround or I would say the fix itself, don't you think that as a viable solution?

You are opening this ticket to make sure it's covered in the WPML itself, am I correct?

Look forward to your reply.

Thanks

September 19, 2019 at 6:58 am #4601733

George L.

To avoid confusion, if I were to leave it to "Don't Translate", we can still translate the component names, which is great. As you said, the components don't get overwritten when saved and in theory, this would work.

The problem with this solution is that if you try to add a new component, the component doesn't show up on the front-end.

Attached, you'll notice that the translated version has picked the product #36 instead of the translated version of that product. This prevents the product from showing up on the front end.

Steps to reproduce
1. Make sure the settings for _bto_data are set to "Don't Translate"
2. Go to the original language of the Composite Product
3. Add a new component
4. Pick any product as a component
5. Save the composite product
6. Check the front end translation. The new component is showing in the original language which is what I'd expect. There are no available options however
7. Refresh the translation of the composite product
8 Check the front end translation. The component is showing in the translation which is what I'd expect. The are still no available options. If step 6 is expected, I'd expect those options to show after I've refreshed the translation.

September 19, 2019 at 7:03 am #4601837

George L.
Just a quick question, since you have found the workaround or I would say the fix itself, don't you think that as a viable solution?

Sorry, not sure what's the workaround you mean?

You are opening this ticket to make sure it's covered in the WPML itself, am I correct?

At this stage, we have no viable workaround. If I leave this to "copy", it means that every time I save a composite product, I have to go to each language and re-add the translations on each component for that language, as they are all replaced with the original language.

Imagine having 20 components and 5 languages.

September 19, 2019 at 7:08 am #4601853

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Sorry, not sure what's the workaround you mean?

I mean settings _bto_data was set to "Don't translate".

When the field is set as copy, you will not need to update the translation for synchronization, it will be auto synchronized.

What are the problems that you are facing when setting it to non-translate? Does it make the components untranslatable?

On the previous reply you provided a steps to reproduce the issue when setting it to non-translate, where you are using manual editor instead of Translation editor, can you try the same steps using translation editor and let me know if that helps?

Look forward to your reply.

Thanks

September 19, 2019 at 7:14 am #4601867

George L.
What are the problems that you are facing when setting it to non-translate? Does it make the components untranslatable?

No, if i leave it as non-translatable, everything looks like it would work, but it doesn't show up correctly on the front end as there are no available options (see translated language.png)

On the previous reply you provided a steps to reproduce the issue when setting it to non-translate, where you are using manual editor instead of Translation editor, can you try the same steps using translation editor and let me know if that helps?

I used the Translation Editor, not the manual editor. The screenshot is from the manual editor to demonstrate the issue

September 19, 2019 at 7:41 am #4602047

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

The translated options is not showing properly as it seems the polo product wasn't translated, I added a translated product to the option and it's showing properly, can you confirm this?

Look forward to your reply.

Thanks

September 19, 2019 at 11:20 am #4604249

George L.

Hi Shekhar,

Setting the _bto_data to "Don't Translate" does indeed preserve the translations when saving the composite product in the original language.

The components are still translatable, so this workaround will probably work for now.

I'm not sure why we had to set _bto_data to "Copy" initially and it could be a bug with your previous version that's now fixed or our lack of knowledge of the plugin. In any case, I'll update the setting and mark this thread as resolved.

There is still an issue whereby the "Default Option" on translations is lost when saving the original language, but this is discussed at https://wpml.org/forums/topic/composite-products-not-saving-default-option-in-_bto_data-on-translations/ and is not part of this thread. A workaround for this, is to open all translations on the Translation Editor and save them.