Cookie Consent Manager
Cookie Consent Banner
The banner replaces the native Shopware cookie notice. It is rendered on every storefront page as soon as the plugin is active for the sales channel.
Structure
- Title and description — editable through snippets (see below)
- One accordion per cookie group with icon, description and toggle
- GDPR detail table per group: name, provider, purpose, lifetime and privacy policy link of every cookie
- Three buttons — Accept all, Only necessary and, as soon as a toggle was changed, Confirm selection
- Links to the privacy policy and the imprint
Required groups (Required group in the group settings) are locked on and cannot be deselected.
Cookies from the Shopware standard are recognised automatically
Cookies that are recognised by the standard Shopware cookie consent are recognised by this extension automatically as well. The plugin reads the Shopware CookieProvider — core cookies (session, timezone, YouTube, Vimeo …) and everything other plugins and apps register through the CookieGroupCollectEvent — and merges those entries into the matching group of the banner:
| Shopware group | Group in the plugin |
|---|---|
| Technically required | necessary |
| Statistics | statistics |
| Marketing | marketing |
| Comfort features | comfort |
Cookies from unknown groups end up in necessary if the group is marked as required, otherwise in comfort. A cookie you already created yourself under Cookies & Scripts is not shown twice — your own entry wins.
Configure them yourself anyway. The automatically adopted entries carry the texts of the respective plugin — often terse, technical or English only. If you want to phrase provider, purpose, lifetime or the privacy link yourself (and you should, because those are exactly the details GDPR asks for), use the Cookie Scanner and create the cookie under Cookies & Scripts. From then on you control the text.
How script blocking works
As long as there is no consent for a group, no script of that group is executed. Three ways are supported:
- Scripts on the cookie — script URL or inline code that you store under Cookies & Scripts. After consent they are inserted at the chosen position (head, start of body, end of body).
- Blocked script tags in the template — write your script as
type="text/plain"and mark the group:
<script type="text/plain"
data-prems-cookie-consent-group="marketing"
data-prems-cookie-consent-src="https://example.com/pixel.js"></script>
- Blocked markup blocks — anything inside a
<template>with a group attribute is only inserted into the document after consent:
<template data-prems-cookie-consent-group="comfort">
<iframe src="https://www.google.com/maps/embed?..."></iframe>
</template>
How the decision is stored
The selection lives in the cookie prems_cookie_consent as JSON:
{
"consentId": "c0ffee00-…",
"version": 1,
"configVersion": 3,
"groups": ["necessary", "statistics"],
"timestamp": 1767225600,
"expires": 1798761600
}
configVersion is the cookie configuration version from the plugin configuration. It is increased automatically as soon as you change cookies or groups — which invalidates older consents and makes the banner ask again.
If a previously granted group is deselected, the page reloads. Scripts that already ran cannot be removed reliably any other way.
Reopening the settings
The plugin adds a link in the footer automatically. You can place additional links anywhere in the template:
{% sw_include '@PremsCookieConsent/storefront/component/prems-cookie-consent-settings-link.html.twig' %}
Alternatively the attribute alone is enough on any element:
<button type="button" data-prems-cookie-consent-open-settings>Cookie settings</button>
Changing the texts
All banner texts are snippets and can be edited under Settings → Snippets — without touching a template and per language:
| Snippet | Content |
|---|---|
prems-cookie-consent.banner.title |
Headline |
prems-cookie-consent.banner.description |
Introduction text |
prems-cookie-consent.banner.acceptAll |
Accept all button |
prems-cookie-consent.banner.rejectAll |
Only necessary button |
prems-cookie-consent.banner.acceptSelected |
Confirm selection button |
prems-cookie-consent.banner.settingsLink |
Label of the footer link |
prems-cookie-consent.banner.renewalHint |
Notice shown when consent has expired |
The labels and descriptions of groups and cookies are maintained on the records themselves — they are translatable.
Extending the template
All shipped templates are split into Twig blocks. You can override them from your own theme or plugin without copying the files:
@PremsCookieConsent/storefront/layout/cookie-consent/prems-cookie-consent-banner.html.twig