The GDPR Cookie Consent plugin provides flexible consent management for websites targeting global audiences. Although it supports GDPR and US State Laws (such as CCPA/CPRA), some site owners prefer a single banner worldwide without the “Do Not Sell My Personal Information” option from CCPA.
This article explains how to configure the plugin to:
- Show the GDPR-style banner for all visitors, regardless of location.
- Set different consent defaults for US visitors versus EU/EEA visitors.
- Disable the CCPA banner and “Do Not Sell” checkbox.
Currently, this use case cannot be configured purely via the plugin’s UI. Instead, you can add a custom function to override cookie behavior depending on the visitor’s IP-based location.
To implement this:
- Open your child theme’s
functions.phpfile. - Add the following PHP snippet:
By adding this snippet, you will:
- Display the GDPR banner globally by selecting Worldwide in the Geo Targeting settings.
- Enable scripts to run by default for US visitors. If a visitor rejects consent, the scripts will then be blocked.
- Block scripts by default for visitors outside the US, ensuring they only run after explicit consent is given.
Display Cookie Consent Notice Only in Legally Required US States
The GDPR Cookie Consent plugin supports geo-targeting, allowing you to display different cookie banners based on a visitor’s location. Store owners may prefer to comply only with US states where cookie consent notices are legally required (such as California or Colorado), while hiding the banner in other states.
To implement this:
- Open your child theme’s
functions.phpfile (never edit the parent theme directly). - Add the following PHP snippet:
Related Articles :