stockRegistry->getStockItem((int)$product->getId(), (int)$website->getId()); $stock = $this->stockResolver->execute(SalesChannelInterface::TYPE_WEBSITE, (string)$website->getCode()); $legacyInStock = (bool)$stockItem->getIsInStock(); $msiSalable = $this->isProductSalable->execute((string)$product->getSku(), (int)$stock->getStockId()); if (!$legacyInStock && !$msiSalable) { $reason = 'both'; } elseif (!$legacyInStock) { $reason = 'manual_out_of_stock'; } elseif (!$msiSalable) { $reason = 'msi_not_salable'; } else { $reason = 'salable'; } return [ 'stock_status' => (int)$legacyInStock, 'is_salable' => (int)$msiSalable, 'stock_id' => (int)$stock->getStockId(), 'reason' => $reason, 'requires_inquiry' => !$legacyInStock || !$msiSalable, ]; } }