Skip to content

Commit

Permalink
feat: export is salable
Browse files Browse the repository at this point in the history
  • Loading branch information
ah-net committed Jun 11, 2024
1 parent b0d4270 commit 1c282a3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Model/Write/Products/CollectionDecorator/StockData.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function decorate(Collection|StockCollection $collection): void
$this->addStockItems($storeId, $collection);
foreach ($toBeCombinedEntities as $item) {
$this->addStockPercentage($item);
$this->addIsSalable($item);
}
}

Expand Down Expand Up @@ -132,6 +133,14 @@ protected function addStockPercentage(ExportEntity|StockExportEntity $entity): v
$entity->addAttribute('stock_percentage', $this->calculateStockPercentage($entity));
}

/**
* @param ExportEntity|StockExportEntity $entity
*/
protected function addIsSalable(ExportEntity|StockExportEntity $entity): void
{
$entity->addAttribute('is_salable', $this->isInStock($entity));
}

/**
* @param ExportEntity|StockExportEntity $entity
* @return float
Expand Down

0 comments on commit 1c282a3

Please sign in to comment.