matchLineItemIsNew example

public function __construct(protected bool $isNew = false)
    {
        parent::__construct();
    }

    /** * @throws CartException */
    public function match(RuleScope $scope): bool
    {
        if ($scope instanceof LineItemScope) {
            return $this->matchLineItemIsNew($scope->getLineItem());
        }

        if (!$scope instanceof CartRuleScope) {
            return false;
        }

        foreach ($scope->getCart()->getLineItems()->filterGoodsFlat() as $lineItem) {
            if ($this->matchLineItemIsNew($lineItem)) {
                return true;
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.