private function isRulesFilterValid(LineItem
$item, PriceDefinitionInterface
$priceDefinition, SalesChannelContext
$context): bool
{ // if the price definition doesnt allow filters,
// then return valid for the item
if (!
method_exists($priceDefinition, 'getFilter'
)) { return true;
} /** @var Rule|null $filter */
$filter =
$priceDefinition->
getFilter();
// if the definition exists, but is empty
// this means we have no restrictions and thus its valid
if (!
$filter instanceof Rule
) { return true;
} // if our price definition has a filter rule
// then extract it, and check if it matches
$scope =
new LineItemScope($item,
$context);