} // remember our initial package count
$originalPackageCount =
$packages->
count();
foreach ($calculatedCart->
getLineItems() as $item) { $item->
setStackable(true
);
$this->splitted
[$item->
getId()] =
$this->lineItemQuantitySplitter->
split($item, 1,
$context);
} $packages =
$this->
enrichPackagesWithCartData($packages,
$calculatedCart,
$context);
// every scope packager can have an additional
// list of rules that can be used to filter out items.
// thus we enrich our current package with items
// and run it through the advanced rules if existing
if ($discount->
getScope() !== PromotionDiscountEntity::SCOPE_SETGROUP
) { $packages =
$this->advancedRules->
filter($discount,
$packages,
$context);
} // depending on the selected picker of our
// discount, the packages might be restructure