How to add a cookie consent banner to a PrestaShop store
PrestaShop has no back-office field for head code, so the snippet goes in your theme's templates/_partials/head.tpl, ideally from a child theme that extends the parent's head_charset block. Clear the cache, mark the tags you paste with type="text/plain" and a data-cq-category, and disable any cookie banner module; the official GDPR module handles data requests, not cookies.Steps
Where to paste the snippet in PrestaShop
Every page of a PrestaShop theme builds its head from templates/_partials/head.tpl. In the Classic theme and in Hummingbird, the file opens with a head_charset block, then the SEO tags, the stylesheets, the javascript_head block and the hook_header block, which is where modules print their tags. The snippet belongs right after the charset, above all of them.
Editing the theme's own file works, but a theme update would remove the line. PrestaShop's developer documentation recommends a child theme, which inherits everything from its parent and overrides only what you change:
- In
/themes/, create a folder such asclassic-childwithconfig/theme.ymland apreview.png:
yamlparent: classicname: classic-childdisplay_name: Classic childversion: 1.0.0assets:use_parent_assets: true
- Create
templates/_partials/head.tplin the child. Theparent:prefix extends the parent's file, so you only redefine one block:
html{extends file='parent:_partials/head.tpl'}{block name='head_charset'}{$smarty.block.parent}<script src="https://cookiequiet.com/cq.js" data-site="YOUR_SITE_KEY" data-consent-mode="1" data-auto-block="1" defer></script>{/block}
- Activate the child under Design, then Theme & Logo, then clear the cache under Advanced Parameters, then Performance.
If your theme is a commercial one, use its name as parent and check that its head.tpl keeps the head_charset block; most themes built on Classic do.
Which cookies does PrestaShop set itself?
PrestaShop keeps the visitor's cart, language, currency and login in one encrypted cookie named PrestaShop- followed by a hash. It is valid for 480 hours (20 days) by default, a value set under Advanced Parameters, then Administration. It is strictly necessary, so it needs no consent. Modules and the tags you add set the rest: run the free cookie scanner on the home page, a product page and the cart to list them.
PrestaShop's official GDPR module (psgdpr) is not a cookie banner. It adds consent checkboxes to forms and lets customers download or delete their personal data, which you still want. Cookie banner modules from PrestaShop Addons should be disabled after the switch, so visitors see one banner.
How to handle the tags modules add
- The official Google Analytics module prints the Google tag in the page HTML from the header hook. A tag printed that way loads before Cookiequiet can hold it. Disable the module (or leave its ID empty) and paste the Google tag in your child's
head.tpl, below the snippet, marked:
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>
E-commerce events (add to cart, purchase) are easier to keep through Google Tag Manager with Consent Mode, which Cookiequiet's data-consent-mode="1" feeds.
- Pixels you paste (Meta, TikTok, Pinterest) get
type="text/plain"anddata-cq-category="marketing". The guide to blocking scripts until consent shows each pattern. - Modules that inject scripts with JavaScript (chat, reviews widgets) are covered by the auto-blocker, which holds the scripts and iframes of about 80 known trackers until consent.
How to add the Cookie preferences link
Go to Design, then Link Widget, edit the block shown in your footer and add a custom link named "Cookie preferences" with the URL #cq-preferences. Cookiequiet opens the preferences centre from any link with that address. A theme without that module can take the link in the child's footer template instead.
How to test
- Open the store in a private window and click Reject all.
- Check the cookies in the developer tools:
cq_consent, thePrestaShop-cookie, and nothing from Google or Meta. - Add a product to the cart and go through the checkout: the cart is kept because PrestaShop's cookie is necessary.
- Clear the cookies, click Accept all, reload: the marked tags run. Check the consent log in the dashboard.
What is specific to PrestaShop
- Smarty cache. With template caching on, changes to
.tplfiles appear only after you clear the cache. - Multistore. Each shop with its own domain needs its own site key so consent logs and policies stay separate.
- Price. Cookiequiet is free for one store with geo-targeting included, and Starter is €3 per website per month with no pageview limit, see pricing.
Questions
Sources
- PrestaShop Developer Documentation: Creating a child theme
- PrestaShop Developer Documentation: head.tpl template
- PrestaShop Classic theme: templates/_partials/head.tpl
- PrestaShop source: Cookie class (PrestaShop- cookie name)
- PrestaShop user documentation: Administration (front office cookie lifetime)
- PrestaShop GDPR module (psgdpr)