=== Abandoned Pro ===
Contributors: yeasirearafat
Tags: woocommerce, cart abandonment, checkout, analytics, insights
Requires at least: 5.8
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 2.3.26
License: GPLv2 or later

WooCommerce cart abandonment recovery with a built-in, rule-based Checkout Intelligence Insights dashboard.

== Description ==

Abandoned Pro tracks WooCommerce checkout sessions as customers type, lets store owners follow up on abandoned carts, and automatically turns that data into plain-language business insights — no external AI API required.

== Changelog ==

= 2.3.26 =
* Removed: the Insight and Marketing tabs, and their related settings toggles, have been removed entirely.
* New: the "User Data" popup now tracks and shows VPN / Proxy / Tor Detection — flags whether a visitor is likely connecting through a VPN, proxy, or Tor exit node.
* New: the "User Data" popup now also shows IP Version (IPv4 / IPv6) for the visitor's Network IP.
* New: 10 more prebuilt Theme colors added to Settings → Theme (Teal, Crimson, Amber, Indigo, Lime, Slate, Fuchsia, Coral, Forest, Cobalt, Obsidian Dark). Switching themes instantly recolors the entire dashboard — every button and small accent included.
* New: this release's upgrades are listed in the Welcome/What's New box shown after updating.

= 2.3.25 =
* Fixed: the Abandoned List box's Action-button dropdown could look cut off/covered by the box, especially for cards near the bottom of the list. Added much more bottom padding to the Abandoned List box so the dropdown's options always have room to fully show.
* Added: a loading-spinner animation in the Abandoned List while a Status tab (Incomplete / Good But No Response / No Response / Approved / Cancel) is loading for the first time — previously this could take a visible moment with no feedback at all.
* New: "User Data" popup now also shows Device IP (a visitor's own local/network-interface IP, captured client-side) alongside the existing Network IP (renamed from "IP Address" for clarity).
* New: blocking/banning a customer (from the Abandoned List's Block button, or "Ban Customer" on a WooCommerce order) now blocks by both Network IP and Device IP together, whenever both were captured — not just Network IP as before.
* New: the Block List popup now shows a Device IP column alongside Network IP for every blocked entry, and gained a second "Block Device IP" field so staff can manually block by Device IP as well as Network IP.

= 2.3.24 =
* Fixed: the Abandoned List box looked cramped and small when there were no orders yet (or very few) — just a thin line of text in an otherwise mostly-blank box. The empty state now has real presence: a centered icon and generous height (340px, 220px on mobile), matching the box's usual proportions instead of collapsing down to fit one line of text.

= 2.3.23 =
* Fixed the real, final root cause of the WordPress admin menu shifting on every admin page (not just this plugin's own dashboard): the checkout-arrival toast's own entrance animation used a horizontal slide (translateX) that pushed it past the viewport's right edge — and since v2.3.20 made that notification sitewide, this now happened on every wp-admin page the moment a toast appeared, anywhere. Switched the animation to a vertical slide instead, which can never cause horizontal displacement.
* Re-verified and locked in: the Abandoned List has no height cap of any kind — it grows fully with however many orders exist, never boxed into a fixed/scrollable window.
* Notification sound redesigned — replaced the triangle-wave chime (which read as an old 8-bit game sound) with a softer two-note sine bell with a warm lowpass filter and a natural decaying tail, closer to a modern iOS/Slack-style notification.

= 2.3.22 =
* Overview setting reworked: it's now a plain show/hide toggle (default on, matching how Overview always worked before) — no minimize/collapse design at all anymore. Turn it on and the full Overview dashboard shows immediately; turn it off and the whole section is hidden.
* The underlying numbers (Total Abandoned, Active, Recovered, Revenue, etc.) keep counting in the background regardless of this setting — turning Overview off never stops the data itself, only hides the section from view.

= 2.3.21 =
* New: Settings → "Overview" — "Show Overview Fully Expanded by Default". Off by default (Overview stays minimized until you open it, as before); turn it on and the Overview dashboard shows fully expanded right away instead. You can still collapse or expand it manually at any time either way — this only controls the starting state. Applies live the moment you save, no reload needed.

= 2.3.20 =
* The "customer entered Checkout" notification (toast + sound) now fires no matter which WordPress admin page you're on — Posts, Pages, WooCommerce Orders, anywhere in wp-admin — not just while this plugin's own dashboard tab is open.
* The notification sound is now a brighter, louder 3-note chime (was a quieter two-tone sine) — easier to notice from anywhere in wp-admin.
* Fixed: the Overview section showed noticeably more height than expected while minimized. It now collapses down to essentially just the bordered header row, not the full panel padding sitting around invisible content underneath.
* Removed the Abandoned List's artificial ~10-card height cap — the list now grows naturally with its content instead of being boxed into a small scrollable window.

= 2.3.19 =
* Overview dashboard: while minimized, only the "Overview" heading and the toggle button are visible now — the date filter, Apply, and Clear Overview controls appear together with the stats once you expand it, instead of always sitting in the header.

= 2.3.16 =
* Removed the Temp Mail Blocker feature entirely (setting, checkout blocking, popup, Abandoned List tag, and all related files) — it wasn't working correctly.
* Insight tab: summary cards now lay out in a clean 3-column grid per row (was a variable auto-fill count) — responsive down to 2 then 1 column on smaller screens.
* Abandoned List's dashboard (Overview) stat cards redesigned to a minimal look: removed the bold colored border and gradient top-bar strip from every card. Icons stay, now as a subtle tinted chip with a solid accent color instead of a bold gradient block.
* The Overview section is now minimized by default and slides open/closed via a new toggle button in its header — smooth, modern slide animation, fully responsive on all devices.

= 2.3.15 =
* New: Settings → "Temp Mail Blocker" (off by default). When on, a customer can't complete an order with a known temporary/disposable email address. Two real layers: an instant popup the moment they leave the Email field with a matching domain (using a well-known public list of disposable-email providers, so no extra request is needed for this early check), and an authoritative server-side block on order submission itself (WooCommerce validation error) — the order genuinely can't go through, not just hidden by JavaScript.
* The Abandoned List now tags each customer's email as "Temp Email" or "Real Email" right next to their email address, so you can tell at a glance.

= 2.3.14 =
* Major performance pass — the direct causes of "Insight/Marketing tab on = the whole plugin feels slower" and the WordPress admin menu shifting:
* Insight and Marketing tabs are now lazy-loaded: neither tab's content (KPIs, funnel, product table, relationships, journey, traffic table, bounce analytics, opportunities, and the 7 attribution boxes) runs a single query on page load anymore. They only fetch the moment you actually open that tab — and every one of those was previously running on every single admin page load regardless of which tab you were looking at, which was the direct, primary cause of the slowdown.
* Fixed an N+1 query pattern in the Product Performance table: exit-rate used to run 2 separate queries per product; now it's 2 queries total for every product at once, however many there are.
* Fixed: the entire WordPress admin menu could shift left/right while using this plugin. Added a hard containment boundary at the plugin's own outermost wrapper so nothing inside it — a wide table, a modal, anything added later — can ever push the surrounding admin page wider than it is. Wide tables (Product Performance, Traffic & Campaign) now scroll within their own box instead of overflowing the page. Confined entirely to the plugin's own container; nothing outside it is touched.
* Checkout/Purchase speed: cut the number of tracking requests roughly in half for a typical page view by merging the separate "pixel count" and "event detail" pings into one request each for ViewContent, Search, and Add to Cart. Also removed a client-side Purchase ping that was firing redundantly (and double-counting) against the authoritative server-side Purchase event already logged from the real order — one less request on the page right after checkout, and a real counting bug fixed at the same time.
* Removed a per-pageview event-table write that nothing ever actually used (a raw PageView row, sitewide, on every single page load) — was pure overhead and unbounded table growth for no analytical benefit.

= 2.3.13 =
* Abandoned List tracking now starts specifically when Phone gets a value — not merely by landing on the Checkout page, and not by typing Name/Email/etc first. Nothing typed before Phone is lost: once the row is created, everything else already filled in gets picked up right after through the existing live-sync mechanism, same as always.

= 2.3.12 =
* Fixed: the "customer arrived at Checkout" notification was also firing right after a purchase completed, on the Thank You page. Root cause: WooCommerce's is_checkout() is also true on the Thank You/order-received page (and order-pay, add-payment-method) — those are checkout endpoints, not the checkout form itself. The tracker (and with it, the notification) now only loads on the actual billing/payment page. This was the only notification source in the plugin, so this fixes it completely — no notification fires without a real reason anymore.
* Fixed the same root cause in the Marketing tab's product tracking: InitiateCheckout was also firing again on the Thank You page for the same reason (WooCommerce puts the woocommerce-checkout body class there too) — now excluded.
* Fixed the checkout field "warning" look for good: after 2.3.10 removed the old readonly-based autofill blocker, browsers were free to autofill again — and Chrome/Edge/Safari's own native autofill highlight (a tinted, often yellow-ish background applied the instant the page loads) was what remained, easily mistaken for a validation warning. Neutralized with a standard CSS override so fields keep their normal look — autofilled or typed, tracking is completely unaffected either way.

= 2.3.11 =
* New: Settings → "Insight Tab" toggle — turn the Insight tab on/off, same as the existing Marketing Tab toggle. On by default so existing sites see no change unless turned off. Toggling live shows/hides the tab immediately, no page reload needed.
* Confirmed: Checkout fields no longer show a touched/warning look on page load (fixed in 2.3.10 by removing the old readonly-based anti-autofill technique), while live field tracking keeps working exactly as before — verified no other part of the plugin marks fields as touched or triggers synthetic blur/focus events.

= 2.3.10 =
* Fixed: "Purchase" felt slow — the Thank You page was synchronously doing a CLV lookup across every past order for that customer plus one database write per order line item, right on the page render that follows completing a purchase. This work now runs in the background via WP-Cron instead, so the Thank You page renders immediately; the marketing data still gets recorded within moments.
* Fixed: Checkout fields looked "already touched and left blank" (a warning-style look) the instant the page loaded, before any real interaction. Caused by an old anti-autofill technique that marked every field readonly on load and re-applied readonly on every blur. Removed entirely — no longer needed now that autofill is already reliably detected and captured a different way, so fields look and behave normally again.
* Abandoned List: switching between status tabs is now instant — each tab's last-fetched content is shown immediately from cache, with a quiet background refresh to catch anything that changed since.
* Fixed: opening the Marketing tab's full-screen "View More" popup could shift the entire page — including the WordPress admin's left-hand menu — left and right. Caused by the popup using 100vw/100vh, which don't account for the scrollbar's width and created page-wide horizontal overflow. Fixed to size itself off its already-correct full-viewport container instead; nothing outside the plugin is touched by this at all now.
* Abandoned List: a cart sitting in the Cancel tab no longer counts toward the dashboard's "Active Abandoned Carts" number — treated exactly the same as a removed cart. Every other dashboard figure (Total Abandoned Carts, Abandoned Revenue, etc.) is unaffected, matching how a removed cart is still counted there too.

= 2.3.9 =
* Marketing tab: added Product Intelligence — a new event-level tracking table (wp_ap_marketing_events, separate from the existing session-level ap_marketing table so product analytics never distort the 7 existing attribution boxes, which are unchanged and still fully functional).
* New: Marketing Overview (10 real KPI cards: Visitors, Product Views, Engaged Visitors, Add to Cart, Checkout Started, Orders, Revenue, Conversion Rate, Bounce Rate, Biggest Funnel Drop-off).
* New: Product Funnel (View → Engagement → Add to Cart → Checkout → Purchase, with real conversion/drop-off between each stage).
* New: Product Performance table (Views, Unique Visitors, Add to Cart, Checkout, Orders, Conversion Rate, real WooCommerce Revenue, Exit Rate, and a Winner/Potential Winner/Needs Optimization/Problem Product/Low Interest status computed relative to this date range's own averages) — full list via View More (reuses the existing modal).
* New: Product Journey (most common "viewed A then viewed B" sequences) and Product Relationships (Frequently Viewed Together from real session co-occurrence; Frequently Purchased Together from real WooCommerce order line items).
* New: Bounce & Exit Analytics breakdown by device, browser, and traffic source.
* New: Marketing Opportunity Engine — automatically generated insights (high-traffic/low-conversion products, hidden winners, trending/declining products vs. the previous period, no-result search terms, mobile-vs-desktop conversion gaps), each backed by a real computed comparison, never templated filler.
* Extended (not duplicated): the existing Search Information box's View More now also shows Top Search Terms, No-Result Searches, and a real Search → View → Add to Cart → Purchase funnel. A new Traffic & Campaign Performance table (Source × Medium × Campaign with real Visitors/Product Views/Add to Cart/Checkout/Orders/Conversion/Revenue) sits alongside the existing Traffic Source and Campaign Information boxes without replacing them.
* Real WooCommerce integration throughout: per-product Purchase events and revenue come from actual order line items (woocommerce_thankyou), never estimated from clicks; "Frequently Purchased Together" comes from real order contents; product-level Checkout events come from the real server-side cart at the moment Checkout loads.
* Product/behavior events tracked: PageView, ViewContent, ProductEngagement, AddToCart, RemoveFromCart, InitiateCheckout, AddPaymentInfo, Search, NoResultSearch, and Purchase — each written once, to one table, per real user action, so nothing is double-counted against the existing Pixel Events box.
* No ad-spend-dependent metrics (CAC/ROAS) were added anywhere in this update, consistent with 2.3.8 removing that setting — nothing here is estimated or fabricated.
* Performance: the new Product Intelligence section only refetches on a date-filter change, not on the existing boxes' 1-second live-poll tick, and every new aggregation is backed by proper table indexes.
* Fully responsive: KPI cards, funnel, tables, and relationship/journey lists all reflow for mobile/tablet without horizontal page overflow.

= 2.3.8 =
* Marketing tab: removed the Meta (Facebook/Instagram), Affiliate Tracking, and Referral Information boxes — 7 boxes remain (UTM Parameters, Campaign Information, Pixel Events, User Journey, Traffic Source, Search Information, Customer Attribution).
* Marketing tab boxes are now a fixed size (content scrolls inside the box if it overflows), and "View More" now opens a full-screen, full-width detail table instead of a small centered popup.
* Removed the "Total Ad Spend (for CAC)" field from Settings → Marketing Analytics, and the CAC (Acquisition Cost) metric along with it, since it required that field.
* Abandoned List: each follow-up tab now has its own "Remove All" button — it only clears the tab you're currently viewing (e.g. clicking it on Good But No Response never touches Incomplete/Approved/etc).
* Fixed: the Block option in the Cancel tab's Action menu was center-aligned instead of left-aligned like every other menu item.

= 2.3.7 =
* New: a "Marketing" tab (Settings → Marketing Analytics, off by default) next to Insight, tracking sitewide (not just Checkout) UTM parameters, Meta/Facebook attribution (fbclid, _fbp, _fbc, hashed PII, real purchase value/currency/order ID from the actual WooCommerce order), affiliate tracking, referral information, campaign information, real pixel events (PageView/ViewContent/AddToCart/InitiateCheckout/AddPaymentInfo/Purchase/CompleteRegistration/Lead/Search), visitor journey (visits/sessions/time on site/pages viewed/bounce), a rule-based Traffic Source breakdown, on-site search terms, and customer attribution (first/last touch, multi-touch log, real CLV, and CAC computed from a store-entered ad-spend figure divided by real purchaser counts — never fabricated). 10 boxes laid out row-by-row, each with a "View More" popup showing full paginated detail rows, a Date filter (Today/Yesterday/7/30/90 days/Custom), fully responsive, and colored using whichever theme is selected under Settings.

= 2.3.6 =
* Checkout field tracking is now effectively 0-latency: the first change to a field after a pause is sent immediately (0ms), instead of always waiting out a debounce delay; further keystrokes typed during that brief window still coalesce into one follow-up send so nothing's lost, and the Abandoned List's own polling was doubled in speed (1s → 500ms) to surface it just as fast.
* A cart that was moved to the Cancel tab now automatically moves back to Incomplete the moment that same customer becomes active on Checkout again (typing, or simply revisiting/refreshing the page with browser-autofilled billing info) — it no longer stays stuck in Cancel.

= 2.3.5 =
* Added a "Block" option to the Action button's dropdown menu on the Good But No Response, No Response, Approved, and Cancel tabs (blocks the customer's IP, same as the block feature from 2.3.3). Not shown on the Incomplete tab. The Cancel tab's Action button now uses the same dropdown as the other tabs (Edit + Block) instead of two separate buttons, for consistency.
* Fixed: the Action dropdown menu was closing itself within about a second, before an option could be selected — caused by the Abandoned List's live poll fully re-rendering the list every tick (the "x seconds ago" Time cell changes constantly, which counted as a change). The list no longer re-renders while a dropdown menu is open, so it stays open until you make a choice.

= 2.3.4 =
* Insight tab: Checkout Insights, Product Insights, Time Insights, and the rest of the sections now lay out row-by-row (two per row on wide screens) instead of stacking one long column down the page.
* Abandoned List billing box now shows the tracked Note field under Email.
* Abandoned List now has five follow-up tabs: Incomplete, Good But No Response, No Response, Approved, and Cancel. New/active abandoned carts start in Incomplete. The Action button's pen icon on every tab except Cancel now opens a menu — Edit plus the valid next steps for that tab (Incomplete → Good But No Response / No Response / Approved / Cancel; Good But No Response and No Response → Approved / Cancel; Approved → Cancel). The Cancel tab is unchanged — Edit and the Block-IP icon, exactly as before. All of the above is responsive on mobile, tablet, and desktop.

= 2.3.3 =
* Billing fields (Name, Phone, Email, Location/State, Order Notes) now reach the Abandoned List effectively live: the per-keystroke send delay was cut from 500ms to 150ms, and the Abandoned List's own polling was sped up from every 8 seconds to every 1 second (matching the Insight tab). What a customer types at checkout now shows up in the Abandoned List within about a second, exactly as typed.

= 2.3.2 =
* Fixed: after a checkout field's first value was tracked (State/location, Name, Phone, Email, or Note), a later change to that same value while other fields were also updating around the same time — via the autofill/polling sync path — could silently fail to save, leaving the Abandoned List showing the old, stale value. Caused by one shared debounce timer covering all fields at once, so tracking one field could cancel another field's pending save before it ever reached the server. Each field now debounces independently, so every field's latest value reaches the Abandoned List correctly.

= 2.3.1 =
* Fixed: the checkout State field (dropdown or typed) was never actually being tracked — an untouched dropdown's own placeholder text ("Select an option…") was being saved as if it were the customer's real answer, so the Abandoned List always showed that same placeholder regardless of what the customer picked. A real, customer-selected state now saves correctly; an untouched field now saves nothing, as expected.
* Fixed: the Insight tab could look completely frozen despite "live" polling — it was reading from a cache that WP-Cron only refreshed every 5 minutes, and on sites where WP-Cron doesn't fire reliably (low traffic, or no real server cron configured) that cache could go stale indefinitely. Every filter range (including Today) is now computed directly from live data on every request, with a lightweight 3-second server-side cache just to keep 1-second client polling from hammering the database — so updates are now genuinely live, independent of WP-Cron.

= 2.3.0 =
* Removed the Apply, Export CSV, Export JSON, and Print buttons from the Insight tab — only the "Filter By Date" control remains.
* Selecting a date range (or, for Custom, filling in both dates) now fetches immediately — no button needed.
* Live auto-update polling sped up from every ~20 seconds to every 1 second.
* No breaking changes — all existing functionality, data, and settings are untouched; the CSV/JSON/Print export code itself is still in the plugin, just not wired to a visible button right now.

= 2.2.1 =
* Removed the Store Health Overview KPI dashboard block from the Insight tab. Smart Summary now leads the page, followed by the sectioned insight cards and breakdown tables.
* KPIs are still computed internally (they feed the Smart Summary's sentences) — they're just no longer rendered as their own card grid.
* Live auto-update (5-minute cache refresh + ~20s background polling, no manual Refresh button) carries over unchanged from 2.2.0.
* No breaking changes — all existing functionality, data, and settings are untouched.

= 2.2.0 =
* Removed the "Checkout Intelligence Insights" title/hero block from the Insight tab — the Smart Summary and everything below it now leads the page.
* Removed the manual "Refresh Insights" button — the Insight tab now updates live in the background on its own; nothing to click.
* Added: a "Live" pulsing indicator with a "last data refresh" timestamp that updates automatically.
* Improved: the underlying insight cache now regenerates every 5 minutes (was hourly), via a new custom WP-Cron schedule — existing installs pick this up automatically, no deactivate/reactivate needed.
* Improved: the Insight tab silently polls for fresh data every ~20 seconds while viewing "Today" (the only range that actually changes minute to minute) — no extra heavy calculation, it simply re-reads the same 5-minute cache.
* No breaking changes — all existing functionality, data, and settings are untouched.

= 2.1.0 =
* Added: Checkout Intelligence Insights — a full Business Intelligence style dashboard inside the Insight tab.
* Added: Store Health Overview KPI section (checkout started, completed, abandoned, recovered, conversion rate, average checkout time, average cart value, recovered/lost revenue).
* Added: Daily Smart Summary — an automatically generated plain-language recap of the selected period.
* Added: Recommendation Engine — every insight card now ships a practical, rule-based recommendation.
* Added: "Why?" modal on every insight card, showing possible reasons, related metrics, and the recommended action.
* Added: Product Insights, Category Insights, Payment Insights, Shipping Insights, and Traffic Source Insights breakdown tables with lightweight, theme-colored CSS bar charts.
* Added: Customer Behaviour stats (returning vs new visitors, repeated checkout sessions, high-intent customers).
* Added: Last 90 Days filter option.
* Added: Print-friendly export, alongside the existing CSV/JSON export.
* Improved: Insights UI is fully responsive (desktop → mobile) and automatically inherits the plugin's active theme colors, including dark mode, via CSS variables — no hardcoded colors.
* Improved: All new calculations run only via WP-Cron or the "Refresh Insights" button (or an explicit filter change) — never on a normal page load.
* No breaking changes — all existing functionality, data, and settings are untouched.

= 2.0.0 =
* Added: Two top-level tabs — "Abandoned" (Dashboard + Abandoned List) and "Insight" (Insight cards) — for a cleaner single-page layout.

= 1.8.9 =
* Added: Auto Insight Generator — rule-based "Daily Insights" widget and Insights section covering Checkout, Device, Payment, Shipping, Product, Traffic, Revenue, Time, Performance, and Customer Behaviour insights.
* Added: Insight card filters (Today / Yesterday / Last 7 Days / Last 30 Days / Custom), Refresh Insights, and CSV/JSON export.
* Added: payment_method, shipping_method, and coupon_code tracking to support the new insight rules.

= 1.8.8 =
* Prior release.
