calculator = $calculator; } /** * Get raw value of "as low as" as a minimal among tier prices * {@inheritdoc} */ public function getValue(SaleableInterface $saleableItem) { /** @var TierPrice $price */ $price = $saleableItem->getPriceInfo()->getPrice(TierPrice::PRICE_CODE); $tierPriceList = $price->getTierPriceList(); $tierPrices = []; foreach ($tierPriceList as $tierPrice) { /** @var AmountInterface $price */ $price = $tierPrice['price']; $tierPrices[] = $price->getValue(); } return $tierPrices ? min($tierPrices) : null; } /** * Return calculated amount object that keeps "as low as" value * {@inheritdoc} */ public function getAmount(SaleableInterface $saleableItem) { $value = $this->getValue($saleableItem); return $value === null ? null : $this->calculator->getAmount($value, $saleableItem); } }