/** * @param float $quantity * @param string $unitCode * @return float */ protected function roundQuantity($quantity, $unitCode) { $precision = 0; $product = $this->quoteProduct->getProductReplacement() ?: $this->quoteProduct->getProduct(); if ($product) { $unitPrecision = $product->getUnitPrecision($unitCode); if ($unitPrecision) { $precision = $unitPrecision->getPrecision(); } } return $this->roundingService->round($quantity, $precision); }