In this post I am going to explain how to load product stock quantity, min quantity and other stock information in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_stockItemRepository; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\CatalogInventory\Model\Stock\StockItemRepository $stockItemRepository, array $data = [] ) { $this->_stockItemRepository = $stockItemRepository; parent::__construct($context, $data); }…


Recent Comments