=== CookiePrime - Consent Management Platform ===
Contributors: samirprime
Tags: cookie consent, gdpr, cookie banner, google consent mode, ccpa, woocommerce, e-commerce, kvkk, pipeda, lgpd, pdpa, privacy, compliance, cmp, consent management
Requires at least: 5.0
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 2.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Professional cookie consent with Google Consent Mode v2. GDPR, CCPA, KVKK compliant. 28 languages including Turkish, Arabic, Japanese, Korean, Indonesian, Thai, Hebrew. Full WooCommerce support.

== Description ==

CookiePrime adds a customizable cookie consent banner to your WordPress site. It helps you comply with all major privacy regulations including GDPR, CCPA, CPRA, KVKK (Turkey), PIPEDA (Canada), LGPD (Brazil), PDPA (Singapore/Thailand), and more.

**🌍 28 Languages Supported** - Auto-detects visitor's browser language:
- **European**: English, French, German, Spanish, Italian, Dutch, Portuguese, Swedish, Danish, Norwegian, Finnish, Greek, Polish, Czech, Hungarian, Romanian, Slovak, Slovenian, Bulgarian
- **Middle East**: 🇹🇷 Turkish, 🇸🇦 Arabic, 🇮🇱 Hebrew
- **Asia**: 🇯🇵 Japanese, 🇰🇷 Korean, 🇮🇩 Indonesian, 🇹🇭 Thai, 🇨🇳 Chinese (Simplified)

**🛒 WooCommerce Ready** - Full support for WooCommerce stores with HPOS compatibility

### Features

* **Google Consent Mode v2** - Fully compatible with Google Analytics and Google Ads
* **Compliance Ready** - GDPR, CCPA, CPRA, KVKK, PIPEDA, LGPD, PDPA compliant
* **28 Languages** - Auto-detects visitor's browser language
* **4 Banner Styles** - Modern, Classic, Minimal, and Premium designs
* **Automatic Cookie Scanning** - We detect and categorize cookies for you
* **Region-Aware** - Shows different options for EU, US, and other visitors
* **Floating Settings Button** - Lets visitors change their mind anytime
* **RTL Support** - Full support for Arabic, Hebrew, and other RTL languages
* **WP Consent API Compatible** - Syncs every consent choice to WordPress so other plugins respect your visitor's decisions
* **🛒 WooCommerce Integration** - Full support for WooCommerce cookies and checkout
* **HPOS Compatible** - Full support for WooCommerce High-Performance Order Storage

### Compliance Frameworks

| Framework | Region | Status |
|-----------|--------|--------|
| **GDPR** | European Union | ✅ Fully compliant |
| **CCPA/CPRA** | California, USA | ✅ Fully compliant |
| **KVKK** | Turkey | ✅ Fully compliant |
| **PIPEDA** | Canada | ✅ Fully compliant |
| **LGPD** | Brazil | ✅ Fully compliant |
| **PDPA** | Singapore/Thailand | ✅ Fully compliant |

### WooCommerce Integration

CookiePrime automatically detects and manages all WooCommerce cookies:

✅ **Cart cookies** - `woocommerce_cart_hash`, `woocommerce_items_in_cart`
✅ **Session cookies** - `wp_woocommerce_session_*` 
✅ **Recently viewed** - `woocommerce_recently_viewed`
✅ **All categorized as "functional"** - Never blocked, always working
✅ **Consent recorded with orders** - Complete GDPR audit trail
✅ **Works with all WooCommerce extensions** - PayPal, Stripe, Subscriptions, and more
✅ **HPOS Compatible** - Full support for WooCommerce 8.0+ High-Performance Order Storage

No configuration needed. Just install and activate.

### WP Consent API Integration

CookiePrime syncs every consent choice to the WordPress Consent API so other plugins that query `wp_has_consent()` (Site Kit, WooCommerce plugins, analytics integrations, etc.) respect what your visitors chose.

Category mapping:
- `analytics` → `statistics`
- `marketing` → `marketing`
- `preferences` → `preferences`
- `functional` and `necessary` → `functional`

Before a visitor makes a choice, non-essential categories are set to **deny**, so third-party scripts are not granted access prematurely.

**Note on consent type:** The WP Consent API plugin is designed around a single static consent model per site. CookiePrime uses per-visitor region detection: strict opt-in for GDPR-scope visitors, opt-out for US visitors, and per-framework defaults elsewhere. Because the WP Consent API layer cannot vary its model per visitor, CookiePrime declares **strict opt-in** universally at that integration boundary. This is the more conservative choice and ensures non-CMP plugins that read `wp_has_consent()` are always on the safe side, regardless of the visitor's jurisdiction. Region-specific behaviour is still applied by CookiePrime's own banner, its Google Consent Mode signals, and its consent record API.

### How It Works

1. **Sign up** at cookieprime.com (free 10-day trial, no credit card)
2. **Add your domain** to your CookiePrime dashboard
3. **Install this plugin** and enter your API Key
4. **Customize your banner** from your CookiePrime dashboard

That's it. The banner appears on your site immediately.

All banner settings (template, colors, categories, Google Consent Mode, languages) are managed from your CookiePrime account, not from WordPress. This keeps your site configuration in sync and lets you change banners without touching the plugin.

== External Services ==

This plugin relies on an external asset delivery network to serve the core consent banner engine efficiently to storefronts. 

It loads a remote JavaScript bundle from Google Cloud Storage:
* Service URL: https://storage.googleapis.com/cookieprime_bucket/public/loader.js
* Purpose: Delivers the live end-user cookie banner interface and execution logic seamlessly.
* Data transmitted: No personal identifiable information (PII) or customer data is tracked or transmitted to this storage bucket. It purely reads asset definitions. Consent choices made by visitors are transmitted to the CookiePrime consent API for compliance auditing.
* Terms & Privacy: This delivery framework operates under the CookiePrime architecture. You can review our Terms of Service (https://cookieprime.com/terms) and Privacy Policy (https://cookieprime.com/privacy).

Consent data sent to the CookiePrime API includes: the site's API Key (domain identifier), a visitor ID (sequential integer, stored locally in the browser), the consent categories accepted or rejected, the visitor's approximate region and IP address for regulatory audit purposes, and a timestamp. No personal identifiable information such as names, emails, or payment data is transmitted.

== Installation ==

**Automatic Installation**

1. Go to Plugins > Add New
2. Search for "CookiePrime"
3. Click Install Now, then Activate
4. Go to Settings > CookiePrime and enter your API Key

**Manual Installation**

1. Download the plugin ZIP from cookieprime.com
2. Go to Plugins > Add New > Upload Plugin
3. Choose the ZIP file and click Install Now
4. Click Activate Plugin
5. Go to Settings > CookiePrime and enter your API Key

**Get your API Key:**
1. Create an account at cookieprime.com
2. Add your domain to your dashboard
3. Copy the API Key (Domain ID)

== Frequently Asked Questions ==

= What privacy regulations does CookiePrime support? =

CookiePrime supports all major privacy regulations including:
- **GDPR** (European Union)
- **CCPA/CPRA** (California, USA)
- **KVKK** (Turkey)
- **PIPEDA** (Canada)
- **LGPD** (Brazil)
- **PDPA** (Singapore, Thailand)

= Does CookiePrime support my language? =

CookiePrime supports 28 languages:
- **European**: English, French, German, Spanish, Italian, Dutch, Portuguese, Swedish, Danish, Norwegian, Finnish, Greek, Polish, Czech, Hungarian, Romanian, Slovak, Slovenian, Bulgarian
- **Middle East**: Turkish, Arabic, Hebrew (RTL support)
- **Asia**: Japanese, Korean, Indonesian, Thai, Chinese (Simplified)

The banner auto-detects your visitor's browser language.

= Does CookiePrime work with WooCommerce? =

Yes! CookiePrime 2.0+ includes full WooCommerce support. All WooCommerce cookies are automatically detected and categorized as "functional" (never blocked). Consent is also recorded with each order for GDPR compliance.

= Is CookiePrime compatible with WooCommerce 8.0+ and HPOS? =

Yes! CookiePrime 2.0+ is fully compatible with WooCommerce 8.0+ and High-Performance Order Storage (HPOS). The order consent meta box works correctly on both legacy and HPOS-enabled installations.

= Do I need to configure anything for WooCommerce? =

No. CookiePrime automatically detects WooCommerce when it's installed and handles everything. Just enter your API Key and you're ready.

= Will WooCommerce cookies be blocked? =

Never. WooCommerce cookies like `wp_woocommerce_session_*`, `woocommerce_cart_hash`, and `woocommerce_items_in_cart` are set as "functional" cookies. They are essential for your store to work and are never blocked.

= Is consent saved with WooCommerce orders? =

Yes. When a customer completes an order, their consent status is saved with the order metadata. This provides a complete GDPR audit trail. You can view this in the order admin screen under "Cookie Consent".

= Does it work with WooCommerce Subscriptions? =

Yes. CookiePrime works with all WooCommerce extensions including Subscriptions, Memberships, and payment gateways.

= Do I need technical skills? =

No. The basic setup takes less than 10 minutes: sign up, copy your API Key, paste it in WordPress. Everything else is configured from your CookiePrime dashboard.

= How do I add my logo to the banner? =

Log into your CookiePrime dashboard, go to your domain settings, and upload your logo. It will appear in the banner automatically.

= Is CookiePrime compatible with the WP Consent API? =

Yes. Every consent choice is synced to the WP Consent API so other WordPress plugins that rely on `wp_has_consent()` will respect your visitors' choices. Analytics maps to the `statistics` category, marketing to `marketing`, preferences to `preferences`, and functional cookies to `functional`.

Because the WP Consent API plugin cannot vary its consent model per visitor, CookiePrime declares strict opt-in at that integration boundary — the safest possible default. Region-specific behaviour is still applied by CookiePrime's own banner, its Google Consent Mode signals, and its consent record API.

= Will this work with my existing plugins? =

Yes. CookiePrime is compatible with the WP Consent API, so other plugins that support it (Google Site Kit, analytics plugins, WooCommerce extensions) will respect your visitor's choices.

= How long does the free trial last? =

10 days. No credit card required.

= What happens after the trial? =

You can choose a paid plan or your account will be paused. The banner will stop appearing until you subscribe.

== Screenshots ==

1. The CookiePrime settings page in your WordPress admin
2. The cookie banner as it appears on your website
3. The preferences drawer where visitors can change their choices
4. Banner customization options in the CookiePrime dashboard
5. WooCommerce integration status display
6. Language support overview
7. Order consent meta box in WooCommerce order admin

== Changelog ==

= 2.0.3 =
* 🐛 **Fixed:** WP Consent API's `wp_has_consent()` now returns correct values. Previously it stayed at its default permissive state (`true`) regardless of the visitor's choice, because the WP Consent API plugin's `wp_consent_type` was unconfigured and its fallback assumes consent.
* 🐛 **Fixed:** CookiePrime's bridge now declares `wp_consent_type = 'optin'` before any `wp_has_consent()` query. This ensures all non-CMP plugins (Site Kit, WooCommerce extensions, analytics integrations) see strict opt-in, which is the correct safe default.
* ✨ Added `window.__cpBridgeVersion` marker for diagnostics.

= 2.0.2 =
* 🐛 **Fixed:** WP Consent API bridge now loads on `wp_footer` so it runs after the WP Consent API plugin's own script. Previously it was queued on `wp_enqueue_scripts` and the inline block was not reliably printed, which left `wp_has_consent()` stuck at its default value.
* 🔗 **Fixed:** Admin settings page now links to the correct dashboard URL.

= 2.0.1 =
* 🐛 **Fixed:** WP Consent API now receives consent updates in the same tab.
* 🐛 **Fixed:** Non-essential categories default to "deny" in the WP Consent API until the visitor makes an actual choice.
* 🐛 **Fixed:** Analytics consent now correctly maps to the WP Consent API `statistics` category.
* ✨ **Improved:** Simplified the WordPress admin settings page to only require the API Key.

= 2.0.0 =
* 🛒 **WooCommerce Integration** - Full support for WooCommerce cookies and checkout
* ✅ Automatic detection of all WooCommerce cookies
* 📝 Consent recorded with WooCommerce orders for GDPR audit
* 🎨 New WooCommerce settings card in admin
* 🔒 All WooCommerce cookies set as "functional" (never blocked)
* 📊 WooCommerce cookie status display in admin
* 🌍 28 languages supported including Turkish, Arabic, Japanese, Korean, Indonesian, Thai, Hebrew
* 📋 Full compliance: GDPR, CCPA, KVKK, PIPEDA, LGPD, PDPA
* 🇸🇦 RTL language support for Arabic and Hebrew
* 🔧 HPOS (High-Performance Order Storage) compatibility
* 🐛 Fixed: HPOS meta box crash on order details screen
* 🐛 Fixed: Infinite filter hook memory leak
* 🐛 Fixed: WooCommerce 8.0+ compatibility issues
* ⚡ Performance improvements for cookie blocking
* 📖 Updated documentation with WooCommerce integration guide

= 1.0.0 =
* Initial release
* Google Consent Mode v2 support
* 4 banner styles
* WP Consent API integration
* Floating settings button
* European language support

== Upgrade Notice ==

= 2.0.3 =
Fixes WP Consent API integration so `wp_has_consent()` returns accurate values. Recommended for all sites using WP Consent API-compatible plugins.

= 2.0.2 =
Fixes WP Consent API bridge timing on hosts where the inline script was not being printed.

= 2.0.1 =
Fixes WP Consent API synchronization so `wp_has_consent()` reflects your visitors' actual choices, and simplifies the admin settings to just the API Key.

= 2.0.0 =
This major update adds full WooCommerce integration, HPOS compatibility, 28 languages, and full compliance with GDPR, CCPA, KVKK, PIPEDA, LGPD, and PDPA. All WooCommerce cookies are automatically managed as "functional" and consent is recorded with orders for complete audit trails. Fully compatible with WooCommerce 8.0+ and HPOS.

= 1.0.0 =
Initial release with Google Consent Mode v2, 4 banner styles, WP Consent API integration, and floating settings button.