Skip Navigation

Dies ist das technische Support-Forum für WPML – das mehrsprachige WordPress-Plugin.

Mitlesen können alle, doch nur WPML-Kunden können hier Fragen veröffentlichen. Das WPML-Team antwortet im Forum an 6 Tagen pro Woche, 22 Stunden am Tag.

This topic contains 7 Antworten, has 2 Teilnehmer.

Last updated by Marcel vor 1 week, 3 Tage.

Assigned support staff: Marcel.

Author Artikel
Januar 18, 2021 um 11:17 pm #7873379

thomasS-48

Tell us what you are trying to do?
WordPress: 5.5.3
WPML: 4.4.8
WooCommerce Multilingual: 4.11.0

-I have a site with WooCommerce and two languages (german native and english)
-I am trying to translate WooCommerce products using the REST API
-Product categories and tags are completely translated
-If i create a product translation (see below), it is created. However, the category and tag is not set automatically (i would assume it is set to the ID that corresponds to the german/native category or tag)
---
{
"lang": "en",
"translation_of": 151804,
"name": "0001-translated product",
"slug": "0001-translated-product",
"description": "<p>Translated product description",
"short_description": "",
}
---
-> This works if i use the WCML "+" button on the backend (in the product overview) to create a translation

Is there any documentation that you are following?
https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

Please help me solving this issue

Best,
Thomas

Januar 19, 2021 um 3:42 pm #7879379

Marcel
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

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

Hallo Thomas,

Vielen Dank, dass Sie den WPML Support kontaktiert haben.

Können Sie mir bitte Ihren gesamten Code, welchen Sie zur Produkterstellung verwenden posten?

Dann prüfen wir dies anhand dieses Beispiels.

Vielen Dank!

Freundliche Grüße
Marcel

Januar 19, 2021 um 3:54 pm #7879491

thomasS-48

Hello

To create i use

POST /wp-json/wc/v3/products
---
{
"lang": "de",
"name": "Test product",
"slug": "test-product",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"manage_stock": true,
"stock_quantity": 1,
"description": "<p>Test product</p>\n",
"short_description": "",
"regular_price": "100",
"sku": "Art. 1 | B100",
"categories": [
{
"id": 325
}
],
"tags": [
{
"id": 279
}
],
"images": [
{
"src": "..."
}
]
}
---

Then if i get the product id i use the following to add an english translation

POST /wp-json/wc/v3/products
---
{
"lang": "en",
"translation_of": 151800,
"name": "Test product translated",
"slug": "test-product-translated",
"description": "<p>Some translated content</p>",
"short_description": ""
}
---

Januar 25, 2021 um 12:12 pm #7920973

Marcel
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

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

Hi,

thanks for the info. I was able to reproduce the issue from scratch and reported it already internally. I will let you know once our WooCommerce Multilingual dev team replied.

Best Regards
Marcel

Januar 26, 2021 um 3:38 pm #7933425

Marcel
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

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

(Internal Status Change)

Januar 27, 2021 um 1:25 pm #7941617

Marcel
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

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

Hi,

our team is already aware of this issue and it's already reported. It will be fixed in a feature version of WCML. As a temporary workaround, you can add the translated categories and tag IDs to your POST request.

I will inform you here once this got solved.

Best Regards
Marcel

Februar 12, 2021 um 8:36 pm #8073911

thomasS-48

Hi

Is this issue already resolved?

Best,
Thomas

Februar 15, 2021 um 8:53 am #8084331

Marcel
Supporter

Languages: Englisch (English ) Deutsch (Deutsch )

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

Hi,

no, as far as I see it will be included in the next version of WooCommerce Multilingual 4.11.3.

I will let you here know once it's published.

Best Regards
Marcel