handleCookies example

public function handle(Request $request$type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
    {
        $this->checkSltCookie($request);

        $request->headers->set('Surrogate-Capability', 'shopware="ESI/1.0"');

        if (str_starts_with($request->getPathInfo(), '/backend/')) {
            return $this->pass($request$catch);
        }

        if (stripos($request->getPathInfo(), '/widgets/index/refreshStatistic') === 0) {
            return $this->handleCookies($request$this->pass($request$catch));
        }

        if (str_starts_with($request->getPathInfo(), '/captcha/index/rand/')) {
            return $this->pass($request$catch);
        }

        $response = parent::handle($request$type$catch);

        $response->headers->remove('cache-control');
        $response->headers->addCacheControlDirective('no-cache');

        
public function preDispatch(): void
    {
        $this->Front()->Plugins()->ViewRenderer()->setNoRender(true);
    }

    public function indexAction(): void
    {
        if ($this->isHttpCacheEnabled()) {
            return;
        }

        $this->handleCookies();
    }

    private function handleCookies(): void
    {
        if (!$this->config->get('cookie_note_mode') || !$this->config->get('show_cookie_note')) {
            return;
        }

        $allowCookie = $this->request->cookies->getInt('allowCookie');

        if ($this->config->get('cookie_note_mode') === CookieRemoveSubscriber::COOKIE_MODE_ALL) {
            
Home | Imprint | This part of the site doesn't use cookies.