Error while updating product variant stock quantity

Issue:
I’ve created a product with one product variant via API. I set a price and stock quantity to it. That works ok.
But, when I update a product via API, adding to it product variants, as a product_variants_attributes field without specifying product variant id, it creates a product variant correctly, with correct price, without stock_entries. When I send an update stock quantity request for this sellable, I have a 404 status code in response. Even though that sellable id is present in product product variants.
Even If i try to change the stock quantity on your UI, stock quantity does not change, but stock quantity of product variant created firstly changes successfully.
Thanx

It looks as though you’re getting that error because the created_by_id isn’t set. This might be because the field is getting overwritten by the update request. This shouldn’t be the case and we will investigate why this is happening on our end.

For now please can you try updating again and ensure that you include created_by in the update PUT request.

Sorry, but can you attach some example
Which value should I set to created_by field?
My user’s id?

As long as it is set to a user_id within that company it should work fine.

Ideally it will be maintained by using the same ID that it was initially created with.

I presume you do a GET request at some point to get the product ID that you want to update, at this point you would ideally also fetch the created_by_id and maintain it.

That was my problem, Thank you, Phil
It is solved now :slight_smile:

Awesome! Glad to hear