we have a Woocommerce website with a few thousand products. We are interested to automatically translate all products, but we want to exclude product titles. I have seen that there is no option for this. Do you have any function or script, which can exclude product names from translation?
Solution: We do not have a script to remove product titles from automatic translation. That would require custom programming.
This has been escalated to a feature request and ultimately will be up to our developers to decide if or when to implement this request. We include all updates in our changelog when new versions are released.
Our developers are not planning to implement this as a feature, but they did come up with a workaround that you can use. Please see the following code that you can add to your site to exlcude the title:
add_filter('wpml_tm_job_field_is_translatable', 'testfield', 10, 2);
function testfield($is_translatable, $job_translate){
global $wpdb;
$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"] ));
$posttype = get_post_type($postid);
if ($job_translate["field_type"] == "title" && $posttype == "product") {
return false;
} else {
return true;
}
}