=== DeviceChecker for WooCommerce ===
Contributors: reztart
Tags: woocommerce, device, mobile, order-attribution, reports
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Requires Plugins: woocommerce
WC requires at least: 8.0
WC tested up to: 9.4
Stable tag: 1.0.0
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Device breakdown (Mobile / Tablet / Desktop) for WooCommerce orders and customers. Dashboard widget plus two reports. HPOS-compatible.

== Description ==

Your WordPress + WooCommerce admin currently shows you the customer's IP but no idea whether they ordered from a phone in a train station or a laptop at their desk. **DeviceChecker** fills that gap in every list you already look at — zero configuration, no external services, no fingerprinting.

= What you get =

* **Orders list** — sortable Device column (HPOS + legacy CPT), tooltip with browser + OS
* **Users list** — sortable Device column, populated on registration
* **Dashboard widget** — Mobile / Tablet / Desktop split for Orders and registered Customers
* **WooCommerce → Reports** — two new device breakdown reports (Orders and Customers) with date-range grouping (day / week / month / year)

= How detection works =

Prioritized:

1. `Sec-CH-UA-Mobile` client hint (strongest signal from Chromium browsers)
2. Optional `Mobile_Detect` library, if vendored into `includes/`
3. Curated built-in regex covering ~99% of real-world traffic
4. Tablet cross-check: iPad / Android tablet / Kindle Fire / Windows tablet

Browser + OS extracted for tooltips (Chrome 120, iOS 17, etc.). Fully User-Agent-based — no cookies, no fingerprinting, no third-party calls.

= HPOS compatibility =

Fully compatible with WooCommerce's High-Performance Order Storage. Uses the `WC_Order` abstraction throughout — no direct `wp_posts` queries. Column hooks registered for both the legacy CPT screen and the new HPOS orders screen.

= What it does NOT do =

* Does not track individual users across sessions (no fingerprinting)
* Does not send any data outside your store — no external API, no analytics beacon
* Does not backfill device info for users that registered before install; orders always work retroactively via WooCommerce's native `_customer_user_agent` meta
* Does not classify bots as a separate category (they render as Desktop with an empty browser tooltip)

= Requirements =

* WordPress 6.5+ (uses the Requires Plugins header)
* WooCommerce 8.0+ (both HPOS and legacy CPT storage supported)
* PHP 7.4+ (tested up to 8.3)

== Installation ==

1. Plugins → Add New → Upload Plugin → choose `devicechecker-for-woocommerce.zip` → Install → Activate
2. Configure at WooCommerce → Settings → DeviceChecker tab (all sections enabled by default)
3. Look for the Device column in WooCommerce → Orders and Users → All Users

== Frequently Asked Questions ==

= Does this slow down my admin? =

No. Each list column uses the User-Agent already stored by WooCommerce; detection is pure PHP regex without external calls. The dashboard widget queries at most 500 recent orders.

= Does this work with headless / decoupled setups? =

If your storefront places orders via REST or Store API and sends a real User-Agent, yes. If your headless client suppresses the UA header, those rows will show as "Unknown".

= Is this GDPR compliant? =

Yes. Stores the User-Agent (not PII on its own) alongside the user_id or IP that WooCommerce already stores. No fingerprinting, no cookies, no external services.

= What happens on uninstall? =

Deactivating leaves everything. Deleting removes plugin options; the companion table is **preserved by default**. Define `DEVICE_DETECTOR_HARD_UNINSTALL` as true in wp-config.php before deletion to drop the table too.

== Screenshots ==

1. WooCommerce Orders list with sortable Device column
2. WP Users list with Device column populated
3. Dashboard summary widget showing Mobile / Tablet / Desktop split
4. Order Device Report — date range × device breakdown
5. Customer Device Report — signups by device over time
6. Settings tab under WooCommerce → Settings → DeviceChecker

== Changelog ==

= 1.0.0 =
* Initial release
* Orders list Device column (HPOS + legacy CPT)
* Users list Device column with sort support
* Dashboard summary widget
* Order Device Report + Customer Device Report under WC → Reports
* Settings tab under WC → Settings → DeviceChecker

== Upgrade Notice ==

= 1.0.0 =
Initial release.
