diff --git a/Model/Write/Products/ExportEntity.php b/Model/Write/Products/ExportEntity.php index ccbed23..70d76c8 100644 --- a/Model/Write/Products/ExportEntity.php +++ b/Model/Write/Products/ExportEntity.php @@ -398,7 +398,7 @@ protected function shouldExportByVisibility(): bool */ protected function isInStock(): bool { - return $this->getStockItem() !== null ? $this->getStockItem()->getIsInStock() : false; + return $this->getStockItem() !== null ? (bool) $this->getStockItem()->getIsInStock() : false; } /** diff --git a/Traits/Stock/HasStockThroughChildren.php b/Traits/Stock/HasStockThroughChildren.php index 6339655..3017f75 100644 --- a/Traits/Stock/HasStockThroughChildren.php +++ b/Traits/Stock/HasStockThroughChildren.php @@ -4,6 +4,7 @@ use Tweakwise\Magento2TweakwiseExport\Model\StockItem; use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\GroupedProduct\Model\Product\Type\Grouped; /** * Trait HasChildren @@ -40,7 +41,8 @@ public function getStockItem(): ?StockItem $qty = (int) array_sum($childQty); $isInStock = min( max($childStockStatus), - $this->getTypeId() === Configurable::TYPE_CODE ? 1 : $this->stockItem->getIsInStock() + in_array($this->getTypeId(), [Configurable::TYPE_CODE, Grouped::TYPE_CODE], true) ? 1 + : $this->stockItem->getIsInStock() ); $stockItem = new StockItem(); $stockItem->setQty($qty);