Example #1
0
 /**
  * Whether to show 'Return to stock' checkbox for item
  *
  * @param Item $item
  * @return bool
  */
 public function canReturnItemToStock($item = null)
 {
     if (null !== $item) {
         if (!$item->hasCanReturnToStock()) {
             $productId = $item->getOrderItem()->getProductId();
             if ($productId && $this->stockItemService->getManageStock($productId)) {
                 $item->setCanReturnToStock(true);
             } else {
                 $item->setCanReturnToStock(false);
             }
         }
         $canReturnToStock = $item->getCanReturnToStock();
     } else {
         $canReturnToStock = $this->_scopeConfig->getValue(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     }
     return $canReturnToStock;
 }
 /**
  * Whether to show 'Return to stock' checkbox for item
  *
  * @param Item $item
  * @return bool
  */
 public function canReturnItemToStock($item = null)
 {
     if (null !== $item) {
         if (!$item->hasCanReturnToStock()) {
             $stockItem = $this->stockRegistry->getStockItem($item->getOrderItem()->getProductId(), $item->getOrderItem()->getStore()->getWebsiteId());
             $item->setCanReturnToStock($stockItem->getManageStock());
         }
         return $item->getCanReturnToStock();
     }
     return $this->canReturnToStock();
 }