This thread is resolved. Here is a description of the problem and solution.
Problem:
You have a WooCommerce website with several thousand products and want to automatically translate all product details except the product titles, but there is no default option available to exclude product titles from translation.
Solution:
We currently do not have a built-in feature to exclude product titles from automatic translation. However, we can offer a custom code solution. You can add the following code to your site to exclude the product titles from being translated:
add_filter('wpml_tm_job_field_is_translatable', 'testfield', 10, 2);<br />function testfield($is_translatable, $job_translate){<br /> global $wpdb;<br /> $postid = $wpdb->get_var( $wpdb->prepare("SELECT `field_data` FROM `wp_icl_translate` WHERE `field_type` = 'original_id' AND `job_id` = %d", $job_translate["job_id"] ));<br /> $posttype = get_post_type($postid);<br /> if ($job_translate["field_type"] == "title" && $posttype == "product") {<br /> return false;<br /> } else {<br /> return true;<br /> }<br />}
Please note that this solution might become outdated or may not apply to your specific case. If this does not resolve your issue or if you have further questions, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If needed, do not hesitate to open a new support ticket at WPML support forum for further assistance.
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 2 replies, has 2 voices.
Last updated by 2 years, 4 months ago.
Assisted by: Lauren.