diff --git a/src/Model/Export/Catalog/Entity/ProductVariation.php b/src/Model/Export/Catalog/Entity/ProductVariation.php index e65951c8..0ba63506 100644 --- a/src/Model/Export/Catalog/Entity/ProductVariation.php +++ b/src/Model/Export/Catalog/Entity/ProductVariation.php @@ -91,8 +91,12 @@ private function getAvailability(): bool return $this->product->isAvailable(); } - $quantity = $this->stockItem->get($this->product->getId()); + try { + $quantity = $this->stockItem->get($this->product->getId()); - return $quantity->getIsInStock(); + return (bool) $quantity->getIsInStock(); + } catch (\Exception $e) { + return $this->product->isAvailable(); + } } } diff --git a/src/Model/Export/Catalog/ProductType/SimpleDataProvider.php b/src/Model/Export/Catalog/ProductType/SimpleDataProvider.php index 023196cb..9f5b853b 100644 --- a/src/Model/Export/Catalog/ProductType/SimpleDataProvider.php +++ b/src/Model/Export/Catalog/ProductType/SimpleDataProvider.php @@ -70,8 +70,12 @@ private function getAvailability(): bool return $this->product->isAvailable(); } - $quantity = $this->stockItem->get($this->product->getId()); + try { + $quantity = $this->stockItem->get($this->product->getId()); - return $quantity->getIsInStock(); + return (bool) $quantity->getIsInStock(); + } catch (\Exception $e) { + return $this->product->isAvailable(); + } } }