Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing issues with WooCommerce custom fields not displaying in secondary languages on your product pages, we have identified a solution.

Solution:
Firstly, ensure that the 'Product Fields (wccf_product_field)' post type is set to Translatable in WPML -> Settings -> Post Types Translation. Then, follow these steps:
1. Go to your product fields.
2. Edit the field in the default language.
3. In the 'Language' section of the right sidebar, click the + icon to add a translation of the field.
4. Translate only the label in the Advanced Translation Editor (ATE) and return to the default language version of the product.
5. Switch to the secondary language from the top admin bar and edit the field, adding conditions and settings to match the default language version.

Alternatively, you can create separate fields for each language without using ATE, which allows for clearer naming of fields and easier management.

If you encounter a 500 Internal Server Error when selecting options from the field, it may be necessary to delete problematic fields, clear the trash, and recreate them one by one, ensuring to translate and synchronize attributes. Also, consider disabling caching and firewall systems while testing.

Please note that this solution may be outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If necessary, do not hesitate to open a new support ticket with us.

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

Last updated by Waqas Bin Hasan 7 months, 1 week ago.

Assisted by: Waqas Bin Hasan.

Author Posts
April 2, 2024 at 7:38 am #15471188

romainO-2

I get a "Incompatible Archive." message when I try to upload the woocommerce custom field plugin (zip).

April 2, 2024 at 3:35 pm #15473963

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Perhaps the zip wasn't created properly. As an alternate, you can download the plugin from original source (i.e. author or plugin website) or can download the folder plugin from your site using FTP, then create zip and finally upload to the sandbox - does it work?

April 2, 2024 at 4:49 pm #15474372

romainO-2

As an alternate, you can download the plugin from original source (i.e. author or plugin website) : not available any more

or can download the folder plugin from your site using FTP, then create zip : that's what I did

April 2, 2024 at 7:06 pm #15474867

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates. Perhaps there's a problem with your download via FTP or creating a zip later on.

However, I installed https://wordpress.org/plugins/download-plugins-dashboard/ in your site (as mentioned earlier) and was able to download and then upload the said plugin in the sandbox site (see attached).

Also notice the red marked stuff on the screenshot:

1) Use your code or try without it for the said plugin, to see if it works.
2) Setup WPML first so WCML and WooCommerce can work correctly.
3) WooCommerce is pointing towards some incompatible plugins, I checked and that custom fields plugin was also flagged. But probably that's due to the step #2. Check after setting up WPML, WCML and WC properly.

Let me know when you're done.

Screenshot 2024-04-03 000224.jpg
April 4, 2024 at 10:07 am #15482153

romainO-2

Hello

It's done.
The bug is still here : hidden link

There is a language switcher in the footer.

April 4, 2024 at 5:48 pm #15485236

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates, I'll check soon and 'll get back to you accordingly.

April 4, 2024 at 11:04 pm #15485969

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting on this.

I was able to make some progress but looks like plugin doesn't support much of the translations side. However, I still have some things to check and 'll get back to you accordingly by tomorrow.

April 5, 2024 at 7:40 am #15486524

romainO-2

Ok thank you

April 5, 2024 at 5:45 pm #15489320

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation. I was able to find the solution, please consider following options. Although both are the same but there's a slight difference for understanding.

Option A
1. Set "Product Fields (wccf_product_field)" post type to Translatable in WPML -> Settings -> Post Types Translation (see attached). So you can add product fields in other languages.
2. Go to product fields.
3. Edit the field in default language (you can switch the language from top admin bar).
4. After setting #1, now you should have a "Language" section in the right sidebar (see attached). Click the + icon (for the first time) to add the translation of the field. This 'll open it in ATE but you'll be able to see only a label which you can translate. This is enough till now.
5. After completing the translation return back to the French version (default lang) of the product.
6. Go back to the fields listing page (i.e. Custom Fields -> Product Fields).
7. Switch to the English (secondary lang) from top admin bar and you should now see a field listed like "no label".
8. Open it for editing, add the conditions and other settings like the French version. However, notice that you should've translated the product attributes beforehand. So when you set the condition based on the product attributes, you 'll be able to search their English versions.
9. Save.
10. And it should work just fine in the frontend.

Option B
I think this option is much better than A, because in option A, if you use ATE for translation it creates a vague (random) number named field (point #7 above). So All the steps are same for this option B, except that don't translate the field with ATE.

But create one field in French and one field in English. I've also demonstrated this in the sandbox site:
- French: My New French Field
- English: My New English Field

This gives you the opportunity to name the fields properly, which may be a crucial requirement when dealing with custom orders later (instead of figuring out fields with no labels or vague/random numbers).

In any case, when you'll be editing the secondary language version of the field, WPML 'll warn you about it. Just ignore and click "Edit anyway" to edit the field as needed.

fr.jpg
en.jpg
lang.jpg
cpt settings.jpg
April 8, 2024 at 1:06 pm #15494184

romainO-2

Great, thank you Waqas.

Unfortunately, I have spent a long time trying to reproduce it on a copy of the live website, but without success... hidden link

It seems that I cannot configure english custom fields like french ones. I'm not sure it's responsible for the bug, but it may suggest some other problems in the plugin :
- by default, english fields status is weird : neither enabled nor disabled. To enable the field, the button within the english custom field page don't change the page status. We can only do so in the custom fields list page
- impossible to set the field like a text area. When I try to, I get this error : "This field type cannot be selected as it is incompatible with current field type. Create a new field instead."

I don't understand what is the difference between your sandbox site and mine. I have tried disabling all the other plugins and setting a default WordPress theme, it's all the same. Any last suggestion ?

2fac1583-3068-4254-9a89-0a02231e7371.png
Capture d’écran 2024-04-08 à 14.56.07.png
April 8, 2024 at 5:05 pm #15495626

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I've tried again in your site, even updated WPML plugins to latest versions (released in previous week), corrected WooCommerce Endpoints (need to be in English - a known issue) and then translated (regardless of site's default lang) and synchronized attributes.

But there's always this error in the logs (500 Internal Server Error), when selecting a choice from the 2nd field:

PHP Fatal error:  Uncaught Error: Call to undefined method WCCF_FB::radio-en() in /home/serveun/www/wp-content/plugins/woocommerce-custom-fields/classes/fields/field-controllers/wccf-field-controller.class.php:2049
Stack trace:
#0 /home/serveun/www/wp-content/plugins/woocommerce-custom-fields/classes/fields/field-controllers/wccf-field-controller.class.php(1926): WCCF_Field_Controller::print_field(Object(WCCF_Product_Field), NULL, 0, Object(WC_Product_Variation), Array)
#1 /home/serveun/www/wp-content/plugins/woocommerce-custom-fields/classes/wccf-wc-product.class.php(363): WCCF_Field_Controller::print_fields(Array, NULL, 1, NULL, Object(WC_Product_Variation))
#2 /home/serveun/www/wp-includes/class-wp-hook.php(324): WCCF_WC_Product->ajax_refresh_product_field_view('')
#3 /home/serveun/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#4 /home/serveun/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /home/serveun/www/wp-admin/admin-ajax.php(192): do_action('wp_ajax_wccf_re...')
#6 {main}
  thrown in /home/serveun/www/wp-content/plugins/woocommerce-custom-fields/classes/fields/field-controllers/wccf-field-controller.class.php on line 2049

Notice that this is the same error we found earlier but with less trace because now only a few plugins are active.

So I deleted one any only radio field, from the product fields, although it was disabled but still was being processed. I deleted it from Trash also. And now there's no 500 Internal Server Error at hidden link when changing field choices.

However, still the conditional fields are not being displayed but I guess that's a matter of some appropriate conditions and cleaning up the fields mess.

I'll recommend deleting all fields from all languages, including the Trash (for all languages). Then create 1 field first, follow the steps to translate and see if it works. Then add another, repeat the process and keep going.

I also noticed that even for default language version of the product, sometimes fields do not appear correctly. I suspect some caching may also be involved. So it is better to disable all caches and firewalls (plugins and/or server side) before testing the above mentioned.

April 9, 2024 at 8:02 am #15497272

romainO-2

Hello Waqas,

I really appreciate all the time you spent to help me, but my client prefers move on to a new plugin, as it getting too complicated with this one.

Thank you very much for your help.

April 9, 2024 at 3:37 pm #15500240

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

You're always welcome. I tried my best.

Please feel free to close this ticket in this case and don't hesitate to open a new one whenever you need any help regarding WPML.

Have a great day 🙂