=== Innosanctum Customer Badges for WooCommerce ===
Contributors: innosanctum
Tags: woocommerce, customer badges, order badges, customer management
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.6.8
License: GPLv2 or later

Know who you're dealing with before you open the order. Automatic customer badges in WooCommerce admin.

== Description ==

Innosanctum Customer Badges adds automatic customer badges to WooCommerce orders and user profiles, based on product purchases, categories, tags, and manual rules.

Most of Innosanctum Customer Badges is free — including unlimited rules, category/tag matching, manual badges, expiry, and the badges column.

Free features:
* Unlimited badge rules
* Match by product, variation, category, or tag
* Multiple products per rule
* Any order status (Completed, Processing, and more)
* Badge expiry
* Manual badges (admin-assigned, with color picker)
* Badges column on the Users and Orders list screens
* Badge position selector (order screen and profile)
* Background and on-demand recalculation
* Full diagnostics screen

Pro features:
* Filter the Users and Orders lists by badge
* Webhook notifier with delivery log (badge_added / badge_removed JSON events)
* Export / import rules and settings as JSON

== Installation ==

1. Upload the plugin to /wp-content/plugins/
2. Activate it in WordPress
3. Go to WooCommerce → Customer Badges
4. Create your first badge rule

Pro: enter your license key on the settings page after purchase.

== Screenshots ==

1. Customer badges shown in the WooCommerce Orders list.
2. Badge Rules — match customers by product, category, or tag, with a color picker.

== Changelog ==

= 1.6.1 =
* Fix: HPOS badges not being assigned — HPOS stores order statuses without the wc- prefix; queries now use the correct format per storage backend

= 1.6.0 =
* WP.org compliance: WP.org build now ships a fully functional free edition — no locked or disabled features
* Free features: 1 badge rule (product match, completed status), badges column on Orders and Users lists, manual badges on user profiles, full diagnostics
* Pro features (unlimited rules, categories/tags, webhooks, import/export, etc.) are available in Innosanctum Customer Badges Pro
* Upsell: single tasteful notice at the bottom of settings linking to the Innosanctum Customer Badges website

= 1.5.16 =
* Fix: "Badges column" checkbox in Display settings is now correctly shown as disabled (Pro feature) for free users
* Fix: HPOS Orders column hooks retain both legacy and WC 9+ screen ID variants

= 1.5.15 =
* Fix: Badges column now appears in HPOS Orders list under WooCommerce 9+ / 10.x — new standalone-menu screen ID (wc-orders) added alongside the legacy submenu screen ID

= 1.5.14 =
* Cleanup: removed per-request diagnostic Init log lines added in 1.5.13

= 1.5.13 =
* Diagnostics: System Status now shows show_badges_column, order_badge_position, and debug_enabled settings
* Diagnostics: Init log now records plugin version, show_badges_column value, and Pro/Free mode on every page load
* Diagnostics: User profile badge save now logs whether it was reached, permission result, and which POST keys were present

= 1.5.12 =
* Fix: Display settings (Badges column toggle) now saves reliably — same direct-DB write used for rules
* Fix: Plugin settings now read directly from DB, bypassing all cache layers (same fix as rules)
* Fix: Removing all manual badges from a user profile now correctly clears them on save (previously skipped if no rows remained in the form)

= 1.5.11 =
* Fix: free version no longer forces badge rule to stay enabled — the enabled/disabled toggle now works correctly in all editions

= 1.5.10 =
* Fix: Upgrade to Pro link now points to innosanctum.gumroad.com (was stale serhiievsky.gumroad.com URL)
* WP.org build: plugin header and readme body now branded as "Innosanctum Customer Badges"
* Landing page: footer link updated to github.com/innosanctum; WP.org alias note added

= 1.5.9 =
* Display settings: new "Badges column" checkbox to show/hide the Badges column in Orders and Users list screens
* Diagnostics: "Manual Recalculation" section removed — Recalculate All button moved into the Diagnostics card
* Diagnostics: "Copy System Status" renamed to "Generate System Status" to better describe what the button does

= 1.5.8 =
* Fix: rules now stored as JSON instead of PHP-serialize — json_encode() escapes emoji as \uXXXX (pure ASCII), making emoji in badge labels work correctly even on MySQL utf8 (non-utf8mb4) databases

= 1.5.7 =
* Fix: rules save now writes directly to DB via $wpdb, bypassing WordPress object-cache comparison — fixes silent no-op saves caused by stale Redis/persistent-cache entries (WP Rocket)

= 1.5.6 =
* Innosanctum Customer Badges mascot shown in plugin settings page header
* Admin page slug changed to woo-badger (?page=woo-badger)
* Settings UI now reads rules directly from DB, bypassing all cache layers (WP Rocket, Redis, object cache) — fixes stale label/color display after save
* Background recalc uses direct SQL instead of wc_get_orders() — fixes badges being incorrectly removed in AS background context
* Emoji-safe save log format (4-byte emoji stripped from log, preserved in rules)

= 1.5.5 =
* Show in Lists checkbox per rule: controls whether a badge appears in the Badges column on Users and Orders list screens
* System Status now shows each rule's full criteria (slug, label, match type, IDs, statuses) — aids diagnosing empty recalc
* Save log now includes match type and product/category/tag IDs per rule, so you can confirm what was actually saved
* Background and manual recalc logs now show the rule criteria snapshot at job start

= 1.5.0 =
* Dedicated wp_ait_wcb_badges table replaces user_meta badge storage
* Auto-migrates existing badges on first activate/update
* Smart rule diff: label/color changes apply instantly (no user scan); deleted rules clean up instantly
* Background recalc now processes only rules whose criteria actually changed
* Daily cron to purge expired badges
* Fast badge filtering in Users and Orders lists via indexed table queries

= 1.3.3 =
* License verification via Gumroad API
* HPOS order list column (wc-orders page)
* Async webhook delivery via Action Scheduler
* Fixed &amp; encoding in webhook endpoint URLs
* Safe uninstall

= 1.2.0 =
* Collapsible rule cards with drag-and-drop ordering
* Auto-contrast badge text color
* Row-based manual badge UI with color picker
* Rule ID auto-generated, hidden from UI
