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

Last updated by Marsel Nikolli 1 year, 8 months ago.

Assisted by: Marsel Nikolli.

Author Posts
October 17, 2023 at 4:57 am #14589669

nguyenL-2

Dear WPML,

I have set "Don't translate" and "Copy" but woocommerce_wp_text_input{} is not working.

How can I set default value is original content?

Thank you,
Nguyen

CleanShot 2023-10-17 at 11.55.17@2x.png
October 17, 2023 at 7:49 am #14590613

Marsel Nikolli

Hi Nguyen,

Thank you for contacting WPML Support.

Please can you tell me how are you adding the custom field, is it throught custom coding or a plugin/theme option?

In order to get the default value of a custom field from the original language to a translation language you need to:

1- go to WPML-> Settings -> Custom Fields Translation (section)
2- search for the ID that you set for "woocommerce_wp_text_input" and set it to "Copy"

The custom field should have the same value as the main language in the translation languages as well.

You can also check our guide on translating custom fields:
https://wpml.org/documentation/getting-started-guide/translating-custom-fields/

Kind regards,
Marsel

October 17, 2023 at 8:15 am #14590945

nguyenL-2

Hi Marsel,

My code: hidden link and my setting up (attachment)

I have saved, when I duplicate product the custom field not locked.

Thank you,
Nguyen

CleanShot 2023-10-17 at 15.13.30@2x.png
October 17, 2023 at 1:45 pm #14595001

Marsel Nikolli

I checked and I saw that your code creates the fields by getting the $loop variable value, meaning that the field's ID on the product is like this "variable_early_bird_expired_date_0" and it is saving only "variable_early_bird_expired_date" as a custom field.

This case requires some custom coding and this falls out of the scope of this support forum, we can't provide custom coding/development.

What we can help with is:
you'll need to change your code in order for it to save the custom fields like "variable_early_bird_expired_date_0", "variable_early_bird_expired_date_1" etc. in order to properly set them on the product page and be able to lock the fields on the translations.

If you need further help with custom coding I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/

Let me know if this helps out,
Marsel

October 19, 2023 at 10:57 am #14614003

nguyenL-2

Thanks Marsel, I don't think variations should have a fixed ID value, if the product has many variations it won't work properly.

Translating custom fields for variation is also a consideration, I hope WPML will consider and handle it in the future.