/**
* Validates the included requirements and returns if the
* line item is allowed to be added to the actual cart.
*/
private function isRequirementValid(LineItem
$lineItem, Cart
$calculated, SalesChannelContext
$context): bool
{ // if we dont have any requirement, then it's obviously valid
if (!
$lineItem->
getRequirement()) { return true;
} $scopeWithoutLineItem =
new CartRuleScope($calculated,
$context);
// set our currently registered group builder in our cart data
// to be able to use that one within our line item rule
$data =
$scopeWithoutLineItem->
getCart()->
getData();
$data->
set(LineItemGroupBuilder::
class,
$this->groupBuilder
);
return $lineItem->
getRequirement()->
match($scopeWithoutLineItem);
} /**
* calculate the cart sum
*/