title: magento2 - How to get a product's stock status enabled/disabled?
body: <p>I'm trying to get whether the product's stock status is instock/outofstock (Integers representing each state are fine. i don't necessarily need the "in stock"/"out of stock" strings per se).</p>
  
  <p>I've tried various things to no avail.</p>
  
  <p>1)</p>
  
  <pre><code>$inStock = $obj-&gt;get('Magento\CatalogInventory\Api\Data\StockItemInterface')-&gt;getisInStock()'
  
  // Magento\CatalogInventory\Api\Data\StockItemInterface :: getisInStock returns true no matter what, even for 0qty products
  // summary: not useful. How do you get the real one?
  </code></pre>
  
  <p>2) </p>
  
  <pre><code>$inStock = $obj-&gt;get('\Magento\CatalogInventory\Api\StockStateInterface')-&gt;verifyStock($_product-&gt;getId());
  
  // test results for "verifyStock":
  // a 0 qty product is in stock
  // a 0 qty product is out of stock
  // summary: fail. find correct method, with tests.
  </code></pre>
  
  <p>3)</p>
  
  <pre><code>$stockItemRepository = $obj-&gt;get('Magento\CatalogInventory\Model\Stock\StockItemRepository');
  stockItem = $stockItemRepository-&gt;get($_product-&gt;getId());
  $inStock = $stockItem-&gt;getIsInStock();
  
  // Uncaught Magento\Framework\Exception\NoSuchEntityException: Stock Item with id "214" 
  // summmary: is stockitem not 1to1 with proudctid?
  </code></pre>
  
  <hr>
  
  <p>The weird thing is, getting stock quantities works just fine. </p>
  
  <pre><code>$availability = (String)$obj-&gt;get('\Magento\CatalogInventory\Api\StockStateInterface')-&gt;getStockQty($_product-&gt;getId(), $_product-&gt;getStore()-&gt;getWebsiteId());
  </code></pre>
  
  <p>So why isn't getIsInStock working?</p>