public function process(CartDataCollection
$data, Cart
$original, Cart
$toCalculate, SalesChannelContext
$context, CartBehavior
$behavior): void
{ Profiler::
trace('cart::product::process',
function D
) use ($data,
$original,
$toCalculate,
$context): void
{ $hash =
$this->generator->
getSalesChannelContextHash($context);
$items =
$original->
getLineItems()->
filterFlatByType(LineItem::PRODUCT_LINE_ITEM_TYPE
);
foreach ($items as $item) { $definition =
$item->
getPriceDefinition();
if (!
$definition instanceof QuantityPriceDefinition
) { throw CartException::
missingLineItemPrice($item->
getId());
} $definition->
setQuantity($item->
getQuantity());
$item->
setPrice($this->calculator->
calculate($definition,
$context));
$item->
setDataContextHash($hash);
} $this->featureBuilder->
add($items,
$data,
$context);
// handle all products which stored in root level
$items =
$original->
getLineItems()->
filterType(LineItem::PRODUCT_LINE_ITEM_TYPE
);