Unfortunately I'm working with wordpress and woocommerce, what I'm trying to accomplish is to insert products and relative translations using the woocommerce REST API, here's the scenario:
- First, i create a simple product
{
"name": "Dummy",
"type": "variable",
"attributes": [
{
"id": 2,
"name": "Color",
"position": 1,
"variation": "true",
"options": [
"Bianco",
"Nero"
]
},
{
"id": 3,
"name": "Size",
"position": 2,
"variation": "true",
"options": [
"A",
"B",
"C"
]
}
]
}
This is a variable product, so I need to create its variations as well The product created return its id, let's say 10
- Then I create several product variations like this:
{
"regular_price": "10.10",
"stock_quantity": 10,
"attributes": [
{
"id": 2,
"name": "Color",
"option": "Bianco"
},
{
"id": 3,
"name": "Size",
"option": "A"
}
]
}
- So I have a product with variations, now i want to create a translation of the product with wpml, according to wmpl rest api specifications, I create a product translation like this:
{
"name": "Dummy en",
"type": "variable",
"lang": "en",
"translation_of": 10
}
- I specified the language
en
, the main language isit
- I included
translation_of
with the id of the original product
What happens is that the english product is created, but without variations
What I have tried:
- Several issues similar to this are solved by the troubleshooting page of wpml, where I can generate missing variations but I need this to be done automatically, products are created automatically, so relative translations too must be
- If I enter product page from wordpress back end and I press the update button, variations are created and adjusted, this word for the original product and the variation, but again, I need this to be done automatically
- I tried to modify and insert the translation in almost all ways, adding/removing sku, id, attributes, categories ecc.
Any hints? Thanks