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.
Tagged: Compatibility, Exception
This topic contains 27 replies, has 2 voices.
Last updated by Waqas Bin Hasan 7 months, 3 weeks ago.
Assisted by: Waqas Bin Hasan.
Author | Posts |
---|---|
March 25, 2024 at 7:39 pm #15448787 | |
romainO-2 |
Hello, I'm using Woocommerce custom fields plugin to add fields in product pages : hidden link Everything works well in french but in english the custom fields are not displayed. Any idea where it could come from ? |
March 25, 2024 at 8:08 pm #15448925 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Hi, Reference to our recent chat, please let me know when you're done with the backup and ready to provide the access, preferably to a test site where the problem has been replicated. Your next answer will be private, to share this information safely. Also provide detailed steps to reproduce the issue and links to pages in admin and on frontend. IMPORTANT: Please take a complete backup of the site to avoid data loss. I may need to activate/deactivate plugins also. See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security. Regards. |
March 25, 2024 at 10:57 pm #15449167 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the access, I'll check and get back to you accordingly (probably by tomorrow as I am just closing my day). |
March 26, 2024 at 8:12 am #15449835 | |
romainO-2 |
I have forgotten to tell you that the custom fields are well displayed when we are logged in only, but not under private browsing for example. |
March 26, 2024 at 7:11 pm #15452966 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the updates. I checked and found that there's a 500 Internal Server Error on the English page, when trying to select the second option for the product (i.e. Custom engraving) - see attached. The apparent reason is that so many active plugins are outdated, specially the ones may be responsible for the overall experience. I also found that your parent and child themes are outdated. Please update everything, clear all caches and try again. And if there's still the issue then we need to recheck the following steps (after updating all plugins and theme): - Deactivate all plugins except WPML, WooCommerce and the said plugin (i.e. needed to minimally create that experience) and check for the issue. |
March 27, 2024 at 3:11 pm #15456664 | |
romainO-2 |
Hi, I have tried everything and no change. I guess the only solution is changing this custom fields plugin for another one. Is there any plugin with the same kind of functionalities that is known to be compatible with WPML ? |
March 27, 2024 at 9:18 pm #15458090 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Well I don't think everything has been tried as I recommended in my previous message. I still see lot of plugins outdated, as well as, the parent theme. I'll advise to go through the recommendations carefully. And if issue still happens, please let me know: - which plugin you're referring to for custom fields? |
March 28, 2024 at 9:32 am #15459565 | |
romainO-2 |
Hi Since I tried deactivating all the plugins exception WPML, woocommerce and custom fields, I don't see what is the point to update other plugins. I did it anyway, the parent theme too and no change. Feel free to make any tests on this test server (same login I guess) : hidden link The current problem is on this plugin : https://wpml.org/plugin/woocommerce-custom-fields-product-add-ons/ My question was if you can advice another compatible plugin with the same kind of functionality (woocommerce fields to customize products) to set instead of this one. Thank you |
March 28, 2024 at 4:24 pm #15461693 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the updates. Yes indeed in the minimal setup we only need to update the required plugins and theme. However since it was live site and I wasn't able to deactivate other plugins, that's why updating others was necessary (as long as they 're in the play). Anyways, good that you have updated plugins and now we have a staging site. I'll of course look into this. But before doing that, since you asked about an alternate plugin - we don't have a specific recommendation or affiliation about it. While here's a list https://wpml.org/plugin/?wpv_view_count=120064&wpv-plugin-functionality=0&wpv_post_search=WooCommerce+Custom+Fields&wpv-wpcf-recommendation-flag=&wpv_filter_submit=Search based on the name of the plugin you're currently using. You can search by different terms to discover more of these. Ideally I'll recommend the ones with latest "tested date". The one you're currently using was last tested in 2016 and there are chances that if we go about it, we may have to chase a long way to make it work. So I'll advise, that you check each plugin for their descriptions and test a few which fulfil your requirements. In either case (current or another plugin), as long as, that's listed in our compatibility, we'd love to help. Please let me know how 'd you like me to proceed? |
March 28, 2024 at 4:50 pm #15461782 | |
romainO-2 |
Thank you |
March 28, 2024 at 7:08 pm #15462327 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Alright, I am checking in staging site and 'll get back to you accordingly. |
March 28, 2024 at 7:49 pm #15462493 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. I investigated in your site and found following Fatal Error in the debug log: [28-Mar-2024 19:23:00 UTC] 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_Variable), Array) #1 /home/serveun/www/wp-content/plugins/woocommerce-custom-fields/classes/wccf-wc-product.class.php(257): WCCF_Field_Controller::print_fields(Array, NULL, NULL, NULL, Object(WC_Product_Variable)) #2 /home/serveun/www/wp-includes/class-wp-hook.php(324): WCCF_WC_Product->display_product_fields('') #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-content/plugins/woocommerce/templates/single-product/add-to-cart/variation-add-to-cart-button.php(15): do_action('woocommerce_bef...') #6 /home/serveun/www/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include('/home/serveun/w...') #7 /home/serveun/www/wp-content/plugins/woocommerce/includes/wc-template-functions.php(3155): wc_get_template('single-product/...') #8 /home/serveun/www/wp-includes/class-wp-hook.php(324): woocommerce_single_variation_add_to_cart_button('') #9 /home/serveun/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #10 /home/serveun/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #11 /home/serveun/www/wp-content/plugins/woocommerce/templates/single-product/add-to-cart/variable.php(71): do_action('woocommerce_sin...') #12 /home/serveun/www/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include('/home/serveun/w...') #13 /home/serveun/www/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1762): wc_get_template('single-product/...', Array) #14 /home/serveun/www/wp-includes/class-wp-hook.php(324): woocommerce_variable_add_to_cart('') #15 /home/serveun/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #16 /home/serveun/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #17 /home/serveun/www/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartForm.php(83): do_action('woocommerce_var...') #18 /home/serveun/www/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php(97): Automattic\WooCommerce\Blocks\BlockTypes\AddToCartForm->render(Array, '', Object(WP_Block)) #19 /home/serveun/www/wp-includes/class-wp-block.php(258): Automattic\WooCommerce\Blocks\BlockTypes\AbstractBlock->render_callback(Array, '', Object(WP_Block)) #20 /home/serveun/www/wp-includes/class-wp-block.php(244): WP_Block->render() #21 /home/serveun/www/wp-includes/class-wp-block.php(244): WP_Block->render() #22 /home/serveun/www/wp-includes/class-wp-block.php(244): WP_Block->render() #23 /home/serveun/www/wp-includes/class-wp-block.php(244): WP_Block->render() #24 /home/serveun/www/wp-includes/blocks.php(1484): WP_Block->render() #25 /home/serveun/www/wp-includes/blocks.php(1522): render_block(Array) #26 /home/serveun/www/wp-includes/block-template.php(263): do_blocks('<!-- wp:templat...') #27 /home/serveun/www/wp-includes/template-canvas.php(12): get_the_block_template_html() #28 /home/serveun/www/wp-includes/template-loader.php(106): include('/home/serveun/w...') #29 /home/serveun/www/wp-blog-header.php(19): require_once('/home/serveun/w...') #30 /home/serveun/www/index.php(17): require('/home/serveun/w...') #31 {main} thrown in /home/serveun/www/wp-content/plugins/woocommerce-custom-fields/classes/fields/field-controllers/wccf-field-controller.class.php on line 2049 When WooCommerce Custom Fields plugin is active, this error is thrown on English version of the product saying 500 Internal Server error (see attached). While deactivating this plugin makes the translation work fine. Although in this case, there are no extra fields shown when changing options (which makes sense). I've tried even with default theme and issue remains the same. As you can see that error is directly being thrown from the said plugin, which somehow seems to trying an internal method name radio() as the translated one radio-en(). Logically it doesn't make sense that methods and functions 'd have translations in the code but it looks like doing it (notice -en) in the method name. But I am not sure about it. So either you'd need to check with plugin author as I couldn't find any report in our systems. I can also escalate the matter to our 2nd tier team for further investigation, but of course this 'll take some time to return with a solution. Please let me know. |
March 29, 2024 at 8:31 am #15463340 | |
romainO-2 |
Hi Waqas, Thanks for this investigation. |
March 29, 2024 at 7:45 pm #15465657 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thanks for the updates. I can escalate the issue to our 2nd tier team, but before that need to check in a fresh environment to make sure that it is reproducible and not just happening in your site. I've created this sandbox site in our servers: hidden link (once click login). It has WPML active but not configured so you can configure as needed. It also has WC, WCML and ST uploaded, so you can configure as needed. You can add the needed plugin and theme to the sandbox too but do not migrate or copy your site here. Use this plugin https://wordpress.org/plugins/download-plugins-dashboard/ to enable downloadable links for plugins and themes in Plugins and Themes pages respectively, in your site. Then you can upload in the sandbox via Plugins/Themes -> Add New. The purpose is to reproduce the problem in fresh & minimal environment. So create one product, translate, create a few options using that WooCommerce Custom Fields plugin, translate and see if it works? Please take your time and let me know when you're done. |
April 2, 2024 at 7:28 am #15471167 | |
romainO-2 |
Ok I will handle it. |