I have tested after changing the code. Everything is working fine when the product is a simple product. If the product have variations then the stock quantity filed will not save the stock of the variable product in inventory tab. But if the product type is simple then in the inventory tab- stock quantity field will save the stock for that product. I think you are trying to save stock when that product have variation. In the variation tab there is a stock option and i saw that stock field is not saving. I am working with it, please allow me some time.
Yes they can save stock for each variation in the variation tab. But this stock quantity will not save in the inventory tab. But in your site in the variation tab stock is not saving, i saw that and i think you were talking about this problem. I will fix it in your site. Just allow me some time.