title: Is there any way to update QTY programmatically using front controller?
body: <pre><code>$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  
  $product = $objectManager-&gt;get('Magento\Catalog\Model\Product')-&gt;load($id);
  
  $productStockData = $this-&gt;stockRegistry-&gt;getStockItem($product-&gt;getId()); 
  
  $productStockData-&gt;setData('is_in_stock', 0);
  
  $productStockData-&gt;setData('qty', 0);
  
  $productStockData-&gt;setData('manage_stock', 1);
  
  $productStockData-&gt;save();
  
  echo "&lt;pre&gt;";
  
  print_r($productStockData-&gt;getData());
  
  exit;
  
  $product-&gt;save();
  </code></pre>
  
  <p>This code gives the correct result with qty in array print but not reflecting in database ..</p>
  
  <p>when it ry to print product data then it return <code>qty</code> 0 (Zero)</p>
  
  <p><a href="https://i.stack.imgur.com/JPenh.png" rel="nofollow noreferrer">Result</a></p>