protected float
$amount = 0.0;
public function match(RuleScope
$scope): bool
{ if (!
$scope instanceof CartRuleScope
) { return false;
} $total = 0.0;
foreach ($scope->
getCart()->
getLineItems()->
filterGoodsFlat() as $lineItem) { $purchasePricePayload =
$lineItem->
getPayloadValue('purchasePrices'
);
if (!
$purchasePricePayload) { continue;
} $purchasePrice =
json_decode((string) $purchasePricePayload, true, 512, \JSON_THROW_ON_ERROR
);
$total += ($purchasePrice[$this->type
] ?? 0.0
) *
$lineItem->
getQuantity();
}