Updating Stock After Variant Creation



I’ve run across a new problem with creating products. After changing the code so it creates variants in batches the timeout issues stopped, but none of these variants show stock and the response from the endpoint is a 404 not found for the put request.

I assume that the system handles stock creation differently when the variant is added compared to when a product with variants is added as this same code used to work fine.

Any help would be appreciated.



Hey Paul,

Which end point are you making the PUT request to?

The way I normally diagnose problems like this is to make the request in the UI with the network tab of developer tools open and look at the request that the UI makes.


Hi Phil,

Just tried through the UI and this is the URL being used:


Which matches the endpoint my code was calling.

And the UI got a 404 response as well so it’s not specific to my script.



Just to add to this, it seems like the whole system is acting like the sellables don’t exist. I get 404’s trying to delete them using the sellable ids provided back from the product update call as well.


Hi Paul,

It seems that you’re getting a 404 here because the Sellable with ID: 18943488 doesn’t seem to exist.
Please can you confirm that this was the URL sent by the UI



Hi Phil,

It was the id that the ui sent, but since then I’ve managed to figure out a different way to do what I was trying to do which is working now and as such the data being used has changed a lot.

Thanks for the reply though.



Good to hear you’ve got it working Paul. What method are you using now?


Hi Phil,

I followed a bit of your advice earlier in the thread and inspected how the UI handled what I was trying to do and I’ve followed what it was doing. I believe it is an undocumented endpoint for product variants that I’ve ended up using.