# How to add a cookie consent banner to a Shopware 6 store

> In Shopware 6, add the snippet from a theme plugin that extends the storefront's meta.html.twig, in the head block that holds the tracking scripts. Then switch off "Use default cookie notification" under Settings, then General, then Basic information, so the built-in consent manager no longer shows, and move the Google tag out of the sales channel's analytics settings, because that tag waits for Shopware's own consent cookie.

Source: https://cookiequiet.com/platforms/shopware
Published: 2026-10-21
Publisher: Cookiequiet

## Steps

1. **Copy your snippet** In the Cookiequiet dashboard, open your website and copy the install snippet: one script tag with your site key, data-consent-mode and data-auto-block set to 1, and defer.
2. **Extend meta.html.twig in your theme plugin** In your theme or a small plugin, create src/Resources/views/storefront/layout/meta.html.twig that extends the storefront's template and overrides the layout_head_javascript_tracking block.
3. **Paste the snippet before the parent block** Inside the block, put the snippet first, then {{ parent() }} so Shopware's own tracking scripts still render after it. Clear the cache with bin/console cache:clear.
4. **Turn off the default cookie notification** In the Administration, go to Settings, then General, then Basic information, and in Legal and compliance switch off Use default cookie notification. Save.
5. **Move the Google tag** Remove the Google Analytics ID from the sales channel's analytics settings and paste the Google tag after the snippet, marked with type="text/plain" and data-cq-category="analytics", or load it through Google Tag Manager.
6. **Add the Cookie preferences link** In Catalogues, then Categories, create a category of type Link, external, with #cq-preferences as the link target, and place it in the footer navigation.
7. **Test the storefront** Open the store in a private window, click Reject all and check that no _ga or _fbp cookie is set. Accept all, reload, and check the consent log.

## Where to paste the snippet in Shopware 6

Shopware 6 has no Administration field for head code. Scripts in the head come from the storefront template `layout/meta.html.twig`, which you extend from your theme or a small plugin, the way Shopware's developer documentation describes for script tags. The block `layout_head_javascript_tracking` holds the tracking scripts Shopware prints itself, so the snippet goes there, before them:

```twig
{# <plugin root>/src/Resources/views/storefront/layout/meta.html.twig #}
{% sw_extends '@Storefront/storefront/layout/meta.html.twig' %}

{% block layout_head_javascript_tracking %}
    <script src="https://cookiequiet.com/cq.js" data-site="YOUR_SITE_KEY" data-consent-mode="1" data-auto-block="1" defer></script>
    {{ parent() }}
{% endblock %}
```

Keep `{{ parent() }}`: without it, the block's original content would not render. Install and activate the plugin if it is new, then clear the cache (`bin/console cache:clear`). Shopware Store extensions that add code to the head do the same job without a plugin of your own, as long as they print it in the head.

## How to turn off Shopware's cookie consent manager

Shopware ships its own cookie consent manager, with the categories Technically required, Comfort functions, Statistics and Marketing. In current Shopware 6 versions, the switch is in the Administration: **Settings**, then **General**, then **Basic information**, card **Legal and compliance**, option **Use default cookie notification**. Shopware's help text says to deactivate it only when you use a third-party solution, which is the case here. Turn it off and save, so visitors see one banner.

Shopware's own cookies stay: the `session-` cookie for the cart and login and `timezone` are technically required, and `cookie-preference` and `cookie-config-hash` (30 days) belonged to the built-in manager. The free [cookie scanner](/tools/cookie-scanner) lists what your extensions add.

## What happens to Shopware's Google Analytics integration?

The Google Analytics ID you enter in a sales channel's analytics settings is printed by Shopware itself. Its template sets Google's consent defaults to denied and only loads the tag once Shopware's own consent cookie for Google Analytics is set, which its consent manager writes. With that manager off, the integration stays silent. Two options:

- **Paste the tag yourself.** Remove the ID from the sales channel and add the Google tag to the same block, after the snippet, marked so it runs only with analytics consent:

```html
<script type="text/plain" data-cq-category="analytics" src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script type="text/plain" data-cq-category="analytics">
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXX');
</script>
```

- **Use Google Tag Manager** for e-commerce events, with Consent Mode fed by `data-consent-mode="1"`, as in the [Google Tag Manager guide](/platforms/google-tag-manager).

Other extensions that register their cookies with Shopware's consent manager and wait for it should be checked one by one: either the extension lets you load it unconditionally (then mark its script or let the auto-blocker hold it), or it keeps waiting for a consent that no longer comes. Scripts injected with JavaScript from about 80 known trackers are held by Cookiequiet's auto-blocker until their category is granted; see [blocking scripts until consent](/guides/block-scripts-until-consent).

## How to add the Cookie preferences link

Shopware's own FAQ uses a link category for its cookie settings, and the same works for Cookiequiet: **Catalogues**, then **Categories**, create a category named "Cookie preferences", set its type to **Link**, the link type to **External**, switch off the protocol option and enter `#cq-preferences` as the target. Activate it and place it in the footer navigation. Cookiequiet opens the preferences centre from any link with that address.

## How to test

1. Open the storefront in a private window. Shopware's cookie bar should be gone and Cookiequiet's banner shown.
2. Click **Reject all** and check the cookies: `cq_consent`, the `session-` cookie, and no `_ga` or `_fbp`.
3. Add a product to the cart and open the checkout: the session cookie keeps the cart.
4. Clear the cookies, click **Accept all**, reload: the marked tags run. Check the consent log in the dashboard.

Cookiequiet is free for one store with geo-targeting included, and Starter is €3 per website per month with no pageview limit, see [pricing](/pricing).

## Questions

### Can I switch off Shopware's built-in cookie banner?

Yes. In current Shopware 6 versions, go to Settings, then General, then Basic information, and switch off Use default cookie notification in the Legal and compliance card. Shopware recommends this only when a third-party solution replaces it.

### Why does Google Analytics stop after I turn off Shopware's banner?

Shopware's built-in integration loads the Google tag only after its own consent manager has stored consent for it. Remove the ID from the sales channel and paste the Google tag after the Cookiequiet snippet, marked for analytics.

### Is there a Shopware plugin for Cookiequiet?

Not needed. A few lines in your theme's meta.html.twig add the snippet to the head of every storefront page, and the rest is set in the Cookiequiet dashboard.

### Which Shopware cookies need no consent?

The session cookie that holds the cart and login, and the timezone cookie, are technically required. Shopware lists them as protected cookies that its own consent manager never removes.

## Sources

- [Shopware Developer: Add JavaScript as script tag (extending meta.html.twig)](https://developer.shopware.com/docs/guides/plugins/plugins/storefront/javascript/add-javascript-as-script-tag.html)
- [Shopware source: storefront layout/meta.html.twig](https://github.com/shopware/shopware/blob/trunk/src/Storefront/Resources/views/storefront/layout/meta.html.twig)
- [Shopware source: Basic information settings (useDefaultCookieConsent)](https://github.com/shopware/shopware/blob/trunk/src/Core/System/Resources/config/basicInformation.xml)
- [Shopware Developer: Cookie consent management](https://developer.shopware.com/docs/concepts/commerce/content/cookie-consent-management.html)
- [Shopware Docs: Cookie Consent Manager FAQ](https://docs.shopware.com/en/shopware-6-en/tutorials-und-faq/howto/cookie-consent-manager-faq)
- [Shopware source: storefront analytics template (Google consent defaults)](https://github.com/shopware/shopware/blob/trunk/src/Storefront/Resources/views/storefront/component/analytics.html.twig)
