_coreRegistry = $registry; $this->stockRegistry = $stockRegistry; parent::__construct($context, $data); } /** * Retrieve current product object * * @return \Magento\Catalog\Model\Product */ public function getProduct() { return $this->_coreRegistry->registry('current_product'); } /** * Retrieve current product name * * @return string */ public function getProductName() { return $this->getProduct()->getName(); } /** * Retrieve product qty increments * * @return float|false */ public function getProductQtyIncrements() { if ($this->_qtyIncrements === null) { $stockItem = $this->stockRegistry->getStockItem( $this->getProduct()->getId(), $this->getProduct()->getStore()->getWebsiteId() ); $this->_qtyIncrements = $stockItem->getQtyIncrements(); if (!$this->getProduct()->isSaleable()) { $this->_qtyIncrements = false; } } return $this->_qtyIncrements; } /** * Return identifiers for produced content * * @return array */ public function getIdentities() { return $this->getProduct()->getIdentities(); } }