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.

This topic contains 1 reply, has 2 voices.

Last updated by Eran Helzer 1 year, 10 months ago.

Assisted by: Eran Helzer.

Author Posts
July 28, 2023 at 2:17 pm #14117909

alexK-25

I have a client that uses WP All Import and WPML in order to create and update their products.

They now need to create a bridge with the software that handles their stock in order to update the current products and create new ones.

There is no issue when updating a product, in English or Greek. When creating a new product though, the new product is created successfully in English, but when trying to create it's Greek translation we get an error that the sku is invalid or already exists.

The code that we run to create the translation is the following:

{"name": "Elastique pour Cheveux Black","type": "simple","regular_price": "0","sale_price": "0","description": "A handcrafted hair elastic made from durable cellulose acetate designed with the Balmain’s signature 18K gold plated B logo.
The extremely strong yet flexible material is hypoallergenic and gentle to the hair and scalp. The hair elastic is specially designed to accentuate one of the iconic Balmain hairstyles∶ the ponytail.",
"short_description": "A handcrafted hair elastic made from durable cellulose acetate designed with the Balmain’s signature 18K gold plated B logo. The extremely strong yet flexible material is hypoallergenic and gentle to the hair and scalp.
The hair elastic is specially designed to accentuate one of the iconic Balmain hairstyles∶ the ponytail.","sku": "1870687.0","lang":"el","categories": [{ "id":556}],"translation_of":24327}

{
"code": "product_invalid_sku",
"message": "Invalid or already existing product code.",
"data": {
"status": 400,
"resource_id": 24327,
"unique_sku": "1870687.0-1"}}

We are using the Woo API documentation and the one provided by you here: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

The website URL: hidden link

I can provide with administrative access if needed.
Thank you in advance.

July 31, 2023 at 7:43 am #14124549

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I apologize for the longer than usual wait.

When WPML manages the translation of a product, it copies some of the properties of the original product, SKU among them. As these are actually the same product, just in a different language, they will share the same SKU, inventory and price.

Please try running the same code, without the "SKU" field in the request.

Please update me on if this resolves your issue.

July 31, 2023 at 12:33 pm #14127275

alexK-25

Thank you for your assistance Eran, seems to be working now.