updated example

foreach ($rules as $rule) {
                ++$index;
                $this->logger->info(
                    sprintf('#%d Rule detection: %s with priority %d (id: %s)', $index$rule->getName()$rule->getPriority()$rule->getId())
                );
            }

            $context->setRuleIds($rules->getIds());
            $context->setAreaRuleIds($rules->getIdsByArea());

            // save the cart if errors exist, so the errors get persisted             if ($cart->getErrors()->count() > 0 || $this->updated($cart$timestamps)) {
                $this->cartPersister->save($cart$context);
            }

            return new RuleLoaderResult($cart$rules);
        });
    }

    private function loadRules(Context $context): RuleCollection
    {
        if ($this->rules !== null) {
            return $this->rules;
        }
Home | Imprint | This part of the site doesn't use cookies.