PromotionDiscountEntity::SCOPE_CART =>
$this->cartScopeDiscountPackager,
PromotionDiscountEntity::SCOPE_SET =>
$this->setScopeDiscountPackager,
PromotionDiscountEntity::SCOPE_SETGROUP =>
$this->setGroupScopeDiscountPackager,
default =>
throw new InvalidScopeDefinitionException($discount->
getScope()),
};
$packages =
$packager->
getMatchingItems($discount,
$calculatedCart,
$context);
// check if no result is found,
// then this would mean -> no discount
if ($packages->
count() <= 0
) { return new DiscountCalculatorResult( new CalculatedPrice(0, 0,
new CalculatedTaxCollection(),
new TaxRuleCollection(), 1
),
[] );
} // 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);
}