When using the api for product import/update including variants i foresee the following workflow:
Input from customer;
Main product - number 123M (this will never be deleted in there PIM / ERP-system)
Variants - 123.1, 123.2, 123.3 (these are flexible)
When importing this article Shopware doesn’t create the mainproduct with 123M but instead it creates a mainproduct with 123.1 and 3 variants 123.1, 123.2, 123.3.
Now i’ve got an issue when i want to update the product.
Once again i receive 123M as main product.
First i check the article api articles/123M?useNumberAsId=true but this returns false because my initial load got overwritten.
This is an issue!
I thought to resolve this by stripping down the mainnumber code from 123M to 123.1 (first variant).
So Main product - number becomes 123.1
Variants remain - 123.1, 123.2, 123.3
When updating i check the article api again articles/123.1?useNumberAsId=true which will return the product.
This can work but what if the customer deletes this variant from the ERP?
Input from customer (first variant deleted);
So Main product - number becomes 123.2
Variants remain - 123.2, 123.3
When updating i check the article api again articles/123.2?useNumberAsId=true which will return false because no main product has that number.
Then i try to create a new product which fails because variants 123.2 and 123.3 already exist.
The logic of having the main product number be identical to one of the variants number doesn’t work for me.
How would i resolve this?