$reference = ReferencePriceDto::
createFromCheapestPrice($cheapest);
$definition =
$this->
buildDefinition($product,
$cheapest->
getPrice(),
$context,
$units,
$reference);
$calculated = CalculatedCheapestPrice::
createFrom( $this->calculator->
calculate($definition,
$context) );
$calculated->
setVariantId($cheapest->
getVariantId());
$calculated->
setHasRange($cheapest->
hasRange());
$product->
assign(['calculatedCheapestPrice' =>
$calculated]);
} private function buildDefinition( Entity
$product,
PriceCollection
$prices,
SalesChannelContext
$context,
UnitCollection
$units,
ReferencePriceDto
$reference,
int
$quantity = 1
):