public function getMatchingItems(DiscountLineItem
$discount, Cart
$cart, SalesChannelContext
$context): DiscountPackageCollection
{ /** @var array<string, mixed> $groups */
$groups =
$discount->
getPayloadValue('setGroups'
);
$definitions =
$this->
buildGroupDefinitionList($groups);
$result =
$this->groupBuilder->
findGroupPackages($definitions,
$cart,
$context);
$lowestCommonCount =
$result->
getLowestCommonGroupCountDenominator($definitions);
// if no max possible groups that have
// the same count have been found, then return no items
if ($lowestCommonCount <= 0
) { return new DiscountPackageCollection();
} $units =
[];
for ($i = 0;
$i <
$lowestCommonCount; ++
$i) { $itemsInSet =
[];