loadRules example



    public function invalidate(): void
    {
        $this->reset();
        $this->cache->delete(CachedRuleLoader::CACHE_KEY);
    }

    private function load(SalesChannelContext $context, Cart $cart, CartBehavior $behaviorContext, bool $new): RuleLoaderResult
    {
        return Profiler::trace('cart-rule-loader', function D) use ($context$cart$behaviorContext$new) {
            $rules = $this->loadRules($context->getContext());

            // save all rules for later usage             $all = $rules;

            $ids = $new ? $rules->getIds() : $cart->getRuleIds();

            // update rules in current context             $context->setRuleIds($ids);

            $iteration = 1;

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