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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 -
- 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 19 replies, has 3 voices.

Last updated by Nigel 6 months, 2 weeks ago.

Assisted by: Nigel.

Author Posts
April 26, 2024 at 12:23 pm

basW-8

Hi

I am trying to update my dutch and English products with categories.

But when I import the categories for the dutch products (I use the import and update function from woocommerce), the categories are not assigned to the dutch products but it creates new (English) categories

April 26, 2024 at 1:21 pm
April 26, 2024 at 1:24 pm #15570892

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thanks for contacting us.

Before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

Can you please share the spreadsheets you're trying to import so we can proceed with our tests?

You can use a file sharing system such as google drive or dropbox or upload it via FTP and letting us know where in the server those files are located.

This will help us better debug this issue.

Thank you,
Mateus

April 26, 2024 at 1:34 pm #15570899

basW-8

You can find the import csv here:
hidden link

April 30, 2024 at 9:46 am #15580639

basW-8

Any news on the progress. We are desperate to fix the issue because we have want to go live with the website and start the marketing campaign for the camping season.

April 30, 2024 at 7:49 pm #15582641

basW-8

??

May 1, 2024 at 12:39 pm #15583964

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

Hi there

I'm sorry for the delay in receiving a response, we've had a busy period in support, but let me try to help.

I have read through the existing conversation to understand the issue, and I've looked at the CSV file you shared.

It's not clear to me that you have followed the required steps, but it's also not clear that those steps are appropriate, because I don't know exactly what you are trying to do.

Sorry if it seems like we are going back to the beginning, but until I'm clear on what you want to achieve I can't comment on what is necessary to do it.

I see that you have an e-commerce site, default language English, Dutch as the only active secondary language.

If I go to WooCommerce > WooCommerce Multlingual & Multicurrency it lists products, and from the first page of results I can see that there are some English products that do not have translations, but paginating through the results I see that most do.

If I switch to the Categories tab of the same page, I see there are 100+ product categories, but it appears that most were originally Dutch, some of which—but not all—have been translated (screenshot).

So, products started as English and have been translated to Dutch. Product categories mostly started as Dutch and have been translated to English.

Can you clarify how the products were originally added to the site? How were they translated?

How were the product categories originally added to the site? How were they translated?

Taking a sample row from the spreadsheet you shared, it includes a Merken product category.

If I search for that, I can see that there is a Merken product category whose original language is Dutch, and another whose original language is English, and they are not connected (not considered translations of each other).

I suspect this relates to the imports you have been doing, adapted by the WPML Export and Import plugin.

Let me talk about that a little, to make sure you understand its purpose.

It's main use is to copy multilingual content from one site to another, and maintain the languages of the content and their relations to each other (i.e. posts being translations of other posts, rather than being independent in different languages).

You can use it just to set the languages of imported content and connect translations.

In the case of WooCommerce, when using its Import tool, you create a CSV file that imports the products (and their categories) in all languages, so your CSV file would include a row for an English product, and a row for the same product in another language, where the languages were specified by the _wpml_import_language_code and _wpml_import_source_language_code columns, and the products can be connected as translations of each other by them both having a common but otherwise unique value in the _wpml_import_translation_group column.

If categories are included that do not currently exist they will be created.

If the CSV file includes both language products as described, distinct language versions of the categories will also be created, and connected as translations of each other, but only once you run the WPML > Export and Import process.

(The documentation is a little confusing in this regard: it states that you must import categories using a separate CSV file before you import posts that use them in a different CSV file, but in the specific example of importing WooCommerce products using the WooCommerce Import tool, that is not necessary. I think it is necessary that your CSV file has the default language product rows before the rows with secondary languages. I will request an update of our documentation.)

Returning to your CSV file, it only includes Dutch products.

I don't know if you already had a CSV file for English products that have been separately imported, and if these included matching values in the _wpml_import_translation_group column to connect the translations with each other (including translations of the product categories).

In a scenario where you already had English products in your site, and you wanted to import translations of these products and connect them, you would need to first export the products while the WPML Export and Import plugin was active, and then re-import them so that the products had the hidden meta fields such as _wpml_import_translation_group which are necessary to connect the Dutch products when they are translated.

There is quite a lot to digest there, but hopefully it is clearer how this is expected to operate, and you can ask for clarification as needed.

Screenshot 2024-05-01 at 12.36.06.png
May 8, 2024 at 7:02 am #15604442

basW-8

I am even more confused by your reply than I was before 😉 WPML is a really hard tool to get right.

What I did and wanted to do (as stated in a previous chat with a colleague of WPML).
We already imported and translated products.
Now we want to add the right categories to these products.
As stated by your colleagues, we created and translated these categories first. (77 categories in English and then translated to Dutch to be precise)

Now we made a csv file from an export of woocommerce (plugin WPML > Export was installed (very confusing build it all in one tool please)), added the categories for the right languages to the csv. So we added the dutch categories for a dutch product and we were going to do the same for the English products). And then imported them back to woocommerce. And this is where the error started.

After the import, we ran the WPML export import tool, it creates a whole bunch of double categories (and in doing so it messes up the Slug so non of the content in the menus match).
I just want to add the right categories that are already in woocommerce to the right translation of a product.

Please tell me how to do this.

Sorry to sound a bit desperate but this plugin has cost me soooo much time.

Thank you for your support.

May 8, 2024 at 9:14 am #15605107

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

OK, from what I understand, you want to assign existing product categories (and their translations) using a spreadsheet, rather than within WordPress.

Presumably because the spreadsheet is an easier interface for applying the categories?

(It's not really an expected use case for the import and export tools, so it is good to know why you are using it this way.)

Looking at your site and the CSV file I think I see why "duplicate" product categories were created in Dutch but with English text.

(I was a little confused because you have "Accessoires" as an English product category, but it isn't an English word; I expect you probably meant to use "Accessories".)

To take a single row from your CSV file as an example, row 219 has a product ID 112581, a variable product "BoglerCo Ultralight Trowel - (schepje - haring)".

For this, the product categories are "Accessoires, Accessoires > Trowels".

Those are English product categories.

But the _wpml_import_language_code column is set to 'nl' (because you are importing Dutch products).

So if that row is Dutch, and there is no Dutch product category "Accessoires", nor child category "Trowels", then the process will create these missing "Dutch" product categories.

That is to say, based on the data being provided in the CSV file, what happened is expected.

I don't have a shortcut to deleting the unwanted "Dutch" categories that were created this way, I think you will need to delete them from within WordPress, from Products > Categories and switching to Dutch.

And then you would need to review your spreadsheet and make sure for Dutch products the categories provided are actually Dutch categories (if they don't exist they will be created).

I also notice that while you provide a language code (nl), you don't specify a value for _wpml_import_source_language_code. If the products within your site were originally created in English and translated to Dutch, this column should have the 'en' language code.

Finally, many rows have blanks for the _wpml_import_translation_group column. Those entries are used to match up the Dutch and English products as translations of each other, rather than them being standalone products in different languages. If the products are translations of each other there should be unique values in this column.

May 14, 2024 at 1:53 pm #15625698

basW-8

I see your point with the accessoires (but is is also the dutch term, and it has it's own category with the same name, but different slug).

But anyway, I tried again (this time on a development site, 1-1 copy of live site).
I used a small csv with all the columns added to it as you described (see screenshot)
And the result is the same. It creates all new categories (so 3 new dutch categories, it does not create child categories and 1 new English categorie, which is actually a dutch categorie "merken")

What am I doing wrong??

Screenshot 2024-05-14 at 15.51.46.png
Screenshot 2024-05-14 at 15.48.19.png
May 14, 2024 at 4:00 pm #15626386

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

I'm not sure how significant a problem it is, but in your spreadsheet you have put nl in both of the wpml language columns.

If these are Dutch posts which are translations of English posts then the language_code column should have 'nl' and the source_language_code column should have 'en'.

If these Dutch posts are standalone Dutch products that are not translations of English posts then the language_code column should contain 'nl' but the source_language_code column should be blank.

Putting 'nl' in both may have confused the process.

Can you delete what you imported before and test again after making that change?

May 14, 2024 at 9:11 pm #15627098

basW-8

Thanks for the quick reply. The original file did not have the nl tag in the source_language_code.
To be sure I removed the NL in this short example csv and it still creates the new categories. (see screenshot, so same result).

I also tried this with a translated product (see the csv). So the same products but in English with English categories and the EN and NL in the meta data.
It gives the same result. It creates all new categories.

Screenshot 2024-05-14 at 23.09.58.png
Screenshot 2024-05-14 at 23.09.16.png
Screenshot 2024-05-14 at 23.06.48.png
Screenshot 2024-05-14 at 22.46.01.png
May 15, 2024 at 3:46 pm #15631582

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

I don't see the same problems on my local test site, it's not clear what I'm missing.

Would it be okay for me to take a copy of your site to install locally so that I can try some test imports myself to observe exactly how this is being processed? Hopefully then I can identify the cause of the problem.

May 15, 2024 at 7:05 pm #15632104

basW-8

Please do anything that you think will help. I have made a duplicate of the website where you can test and trash everything. Do you want access to that?

I experimented the whole day and succeeded in uploading and modifying some products with the right categories. I can give you that CSV. But after that I tried with another set (and of course I imported this on the live site) and it messed everything up in a really bad way.
I can give you the 2 CSV files to try?

One thing that I noticed is when importing some English products, that before I run the WMPL export import, there are a lot of "new" dutch categories added. After the tool is finished, most of these are gone (not all) and "new" double English categories are created.

Thanks for helping.

May 16, 2024 at 6:42 am #15633052

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

Please go ahead and share the CSV files with me. (You can just paste links to dropbox, wetransfer or similar here and they will be automatically hidden.)

If I have problems copying the site I'll ask about the development site.

The topic ‘[Closed] Issue with import of categories in secondary language’ is closed to new replies.