I have added several thousand products to a test store through the Rest API. I have saved the Product ID and Inventory Item ID for each product in a database table with other product information. When I went to update Inventory Cost, using the saved Inventory Item Id, I am receiving 404 errors, not found. When I compare the Inventory Item Id that was saved at the time the product was added with the Inventory Item Id currently (only 2 days have elapsed), they are completely different for the Product ID in question. As I test this with other products, same thing.
I haven't read anywhere that this should happen - and, it seems that for efficiency, I shouldn't have to query the product id every time I need an inventory item id to do an update. What am I missing here?
Thanks for any suggestions.
Solved! Go to the solution
This is an accepted solution.
You're correct that this shouldn't be happening. Did you make any changes to your product variant options (size, color, etc) before you went to update the cost? Inventory items have a 1:1 relationship with variants, and depending on what you change in the options this can cause variants to be recreated, which means they will also have a new inventory_item_id. That's the only thing I can think of off the top of my head, but if you're still having an issue please provide some variant_id examples and I'll check our logs for more info.
Sorry for the delay in getting back here. I have also had some issues with "bad characters" getting into local database fields I am keeping for Shopify Id and Inventory Item Id. I believe it is an issue with ansi vs unicode at this point. I am running some further tests to see if it is now rectified.
Thanks for the confirmation that the ID shouldn't change unless there are certain specific conditions. That helps.