Skip Navigation

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: 

This topic contains 21 replies, has 3 voices.

Last updated by Shekhar Bhandari 1 year, 9 months ago.

Assisted by: Shekhar Bhandari.

Author Posts
September 13, 2023 at 11:48 am #14389825

jevgenijsG

I have 3 languages on my website - Latvia(default), English, Russian.
Right now my Product Titles, Product Descriptions, Product Content loaded in Latvian language only. WPML in configured to "use translation if available or fallback to default language".
Amount of products to update translation 5000-6000.

I would like to upload English text from my csv file for the following strings:
Product Title(post_title)
Product Description(post_excerpt)
Product Content(post_content)

I have tried to do it using WP All Import however it didn't upload my translation to products.
Besides that it say in log that it deleted product images, which I untick in import settings.

website: hidden link

Please kindly guide though the process.

Kind regards,
Max

September 13, 2023 at 3:13 pm #14391047

jevgenijsG

I have created php code that updates product details from csv file, however it updates data from csv for all translations, but I would like to update 'en' only.

If possible please advise how to adjust code to update product data only for selected language?

php code below:

<?php
// Load WordPress and WPML
require_once('wp-load.php');

// Function to update product translation and provide debugging messages
function update_product_translation($sku, $title, $description, $content) {
// Get the product post ID by SKU
$product_id = wc_get_product_id_by_sku($sku);

if ($product_id) {
// Get the default language
$default_language = apply_filters('wpml_default_language', null);

// Set the language to English for translation
do_action('wpml_switch_language', 'en');

// Update the product title, description, and content
$update_args = array(
'ID' => $product_id,
'post_title' => $title,
'post_excerpt' => $description,
'post_content' => $content,
);

$result = wp_update_post($update_args);

if (is_wp_error($result)) {
echo "Error updating SKU $sku in English: " . $result->get_error_message() . "\n";
} else {
echo "Updated SKU $sku in English.\n";
}

// Reset the language to the default
do_action('wpml_switch_language', $default_language);
} else {
echo "Product with SKU $sku not found.\n";
}
}

// Read and process the CSV file
if (($handle = fopen('products.csv', 'r')) !== false) {
while (($data = fgetcsv($handle, 1000, ',')) !== false) {
$sku = $data[0];
$title = $data[1];
$description = $data[2];
$content = $data[3];

// Call the function to update the product translation for English
update_product_translation($sku, $title, $description, $content);
}
fclose($handle);
}
?>

September 15, 2023 at 6:01 am #14400647

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

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

Hi,

Thank you for contacting the support. Meanwhile one of my colleagues takes up the case, I'll request to consider followings:

- Custom coding support is out of scope of this forum.
- Check these guides and see if these help:
--- https://wpml.org/documentation/plugins-compatibility/export-multilingual-websites-using-wp-all-export-wpml/
--- https://wpml.org/documentation/related-projects/wpml-all-import-plugin-website-import-with-wpml/

Additionally, please provide debug information of your website for an overview of your setup. See https://wpml.org/faq/provide-debug-information-faster-support/ for more information.

I've enabled the debug information section for your next reply.

You can also take a look at https://wpml.org/faq/checklist-before-opening-a-ticket-in-wpml-support/ and cross-check for a few initial fixes.

See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security.

Regards.

September 15, 2023 at 9:49 am #14402157

jevgenijsG

Dear Waqas Bin Hasan,

Thanks for your response.

Already went through this but it doesn't work for me.
- Check these guides and see if these help:
--- https://wpml.org/documentation/plugins-compatibility/export-multilingual-websites-using-wp-all-export-wpml/
--- https://wpml.org/documentation/related-projects/wpml-all-import-plugin-website-import-with-wpml/

added debuting info.

September 18, 2023 at 5:20 am #14409067

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

In order to import only the translations you will need to follow the below steps:

- Export current page posts in a CSV
- Now set a unique identifier in the CSV file that matches with the identifier in the translated CSV
- Once the identifier is set properly, import the products in the default language
- Then you will need to import the secondary languages/

Can you check and confirm if the imports are done in this way? Is the unique identifier set properly?

Can you send us screenshots of your CSV files for the default and secondary language for 1 product?

Look forward to your reply.

Thanks

September 18, 2023 at 9:03 am #14410263

jevgenijsG

Dear Shekhar Bhandari,

Thank you for your reply.

Sorry I didn't get what do you mean by:
1. "Export current page posts in a CSV"? - Please guide on steps of doing this process.
2. Where and how to set "a unique identifier" ? which identifier we are referring to?

Which are we using to do those steps?

Kind regards,
Max

September 18, 2023 at 10:05 am #14410891

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

You can export posts from sites using the steps as mentioned here: https://wpml.org/documentation/plugins-compatibility/export-multilingual-websites-using-wp-all-export-wpml/

For unique identifier use the following documentation: https://wpml.org/documentation/related-projects/wpml-all-import-plugin-website-import-with-wpml/importing-multiple-languages-with-wp-all-import-and-wpml/#add-a-unique-identifier-to-your-spreadsheets

Let me know if this helps.

Thanks

September 19, 2023 at 2:56 pm #14420685

jevgenijsG

Dear WPML team,

I have successfully exported all products using 1st step.

Now I am facing issue with 2nd step. I have 2 tables in default language(lv) and secondly language(eng).

https://wpml.org/documentation/related-projects/wpml-all-import-plugin-website-import-with-wpml/importing-multiple-languages-with-wp-all-import-and-wpml/#import-the-default-language-file
step 5. It says in your instructions: Map the unique identifier to the correct element in your CSV or XML file."

I have attached my test table for default language.

My question is how do I map product from file with woocommerce product if unique identifier is not set yet? Should I use SKU or Product ID number? And later map secondary language translations from other table to SKU or Product ID?

Kind regards,
Max

Screenshot 2023-09-19 at 17.43.12.png
September 20, 2023 at 5:54 am #14426289

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Once you export the CSV file, you can create a new column and define a unique identifier for one product. or if the product ID or SKU is unique you can use that one.

Once you have created the CSV, import the product in primary language and then import it in secondary language, that way, the import will be linked properly.

Let me know if this helps.

Thanks

September 22, 2023 at 3:04 pm #14447657

jevgenijsG

Dear Team,

I have just tried to do those steps, but it didn't work out.
1. I exported and re-imported 5 products and set unique identifier using product ID.

Eng translations didn't come up.

Please advise to fix it or/and debug the process.

Kind regards,
Max

September 25, 2023 at 4:28 am #14454285

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Can you please provide the import ids you imported?

To debug this issue further, I would need to check your site settings once, for this I would need temporary access (wp-admin and ftp) to your site.

So could you please provide me with those details, you will find the needed fields for this below the comment area when you log in to leave your next reply.
hidden link

This info is private and available to you and WPML supporters only.
Read more about this: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Note:
Backup your sites before providing the credentials or if possible provide credentials for the test site

Look forward to your reply.

Thanks

September 26, 2023 at 4:33 am #14462919

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Most of the admin pages aren't working showing the following error

This page isn't working at the momentenergygroup.lv redirected you too many times.

The redirection is set using Nginx, so can you check if the settings are okay?

Look forward to your reply.

Thanks

September 26, 2023 at 9:24 am #14465255

jevgenijsG

Dear Shekhar,

We have fixed issue. Website is accessible now.
Kindly proceed on resolving.

Kind regards,
Max

September 26, 2023 at 1:01 pm #14467213

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Can you please update WooCommerce and WooCommerce Multilingual to the latest version?

Note: Create a backup before proceeding.

Also, the import ID you provided doesn't exist on this site. hidden link

Can you please check?

69692
69691
69690
69689
69688

Look forward to your reply.

Thanks

September 26, 2023 at 3:00 pm #14467989

jevgenijsG

Dear Shekhar,

Those are product ID's. I used them as Unique Identifier for import and they exist on website. Please find screenshot attached.

Backup created.
WooCommerce and WooCommerce Multilingual updated .

Kind regards,
Maxim

Screenshot 2023-09-26 at 17.54.52.png