Hello Osama
I created a code on function.php, that need to be shown on all the languages, right now, only the english language, main website language, are showing this code, I was able to get the string translated, but i believe i done something wrong, because i only need to translate the "title" the value is the same. this is the code I created
// Add GTIN / EAN column to product list view
add_filter( 'manage_edit-product_columns', 'add_gtin_ean_column_to_product_list' );
function add_gtin_ean_column_to_product_list( $columns ) {
// Add new column
$columns['gtin_ean'] = __( 'GTIN / EAN', 'woocommerce' );
return $columns;
}
// Populate GTIN / EAN column with value
add_action( 'manage_product_posts_custom_column', 'populate_gtin_ean_column', 10, 2 );
// Sync GTIN/EAN meta field across translations
function sync_gtin_ean_with_translations($post_id, $post, $update) {
if ($post->post_type != 'product') {
return;
}
// Get GTIN/EAN value
$gtin_ean = get_post_meta($post_id, '_gtin_ean', true);
// Get translated post IDs
$translations = apply_filters('wpml_get_element_translations', null, apply_filters('wpml_element_type', 'post_product'), $post_id);
foreach ($translations as $lang => $translation) {
// Skip the original language
if ($translation->element_id == $post_id) {
continue;
}
// Update translated post meta
update_post_meta($translation->element_id, '_gtin_ean', $gtin_ean);
}
}
add_action('save_post', 'sync_gtin_ean_with_translations', 10, 3);