DEV3 AI Store Insights for WooCommerce

WooCommerce reporting plugin: store owners type questions like "best sellers in Dubai last month" and get a chart, the table behind it and a short explanation. The AI only picks one of 11 read-only reports and fills typed options; it never writes a query.

by DEV3 TechnologiesVerified Author(0) 0 downloads 0 viewsUpdated 29 Oct 2026
1 / 8

WooCommerce reporting plugin: store owners type questions like "best sellers in Dubai last month" and get a chart, the table behind it and a short explanation. The AI only picks one of 11 read-only reports and fills typed options; it never writes a query. Free download: sign in and click Download ZIP. Add your own Google AI Studio (Gemini) API key to switch on the AI features; the documentation says which features work without one.

How it works

We built DEV3 AI Store Insights as a WooCommerce plugin in PHP with a React admin. Every number comes from the WooCommerce Analytics lookup tables (wc_order_stats, wc_order_product_lookup, wc_customer_lookup and the coupon and product meta lookups), so the plugin reads the same data WooCommerce's own reports use.

Key design decisions

  • Function calling, not text-to-SQL. The Google Gemini API receives 11 function declarations (store summary, sales trend, top products, top categories, sales by location, customer segments, top customers, refunds, cohorts, stock status, top coupons) with tool_mode: ANY. It can only return a function name and typed arguments: enums, a bounded integer and short strings.
  • Every call is validated twice. Library::sanitize() rejects unknown functions, drops unknown keys, replaces invalid enums with defaults, clamps numbers, cuts strings to 80 characters and falls back to the last 30 days when a custom date is invalid. Values then reach the database only through $wpdb->prepare().
  • One query builder, two order storages. Country, region and city come from wc_order_addresses when HPOS is authoritative and from postmeta when legacy storage is. OrderUtil decides at runtime, and refunds are joined to their parent order's address.
  • Works without AI. A rule-based parser handles common phrasings ("top 5 products by units sold this year", "in March 2026", "past 14 days"), and Explore builds any report by hand. AI only interprets the question and explains the result.
  • Explanations from aggregates only. The model sees the report title, period, columns and at most 15 rows. Customer names become "Customer 1, 2…" unless the owner allows names, and emails never leave the site.
  • Owner-friendly extras. Saved questions that re-run on fresh data, a pinned dashboard with one date range for every card, scheduled HTML email digests, anomaly alerts (z-score against a 28-day baseline, with the products and countries that moved most) and formula-safe CSV export.

Architecture

The Ask endpoint plans the question (AI function calling or the rule parser), re-sanitises each call, runs it through a query builder that only accepts whitelisted metric expressions and placeholder values, and returns a result object that the React app renders as an accessible SVG chart with a table toggle. WooCommerce's excluded-status setting is honoured, periods resolve in the site timezone and week start, and a data-health check imports any order the Analytics tables missed. Daily alert checks and hourly digest ticks run on WP-Cron. The API client, encrypted key storage, usage logs and admin UI kit come from a shared core used across DEV3's plugins.

What's in the download

  • The installable plugin zip: upload it through Plugins → Add New → Upload Plugin.
  • Full HTML documentation (installation, settings, hooks, FAQ).

Requirements

  • WordPress 6.0 or newer and PHP 7.4 or newer
  • WooCommerce 8.0 or newer, active, with WooCommerce Analytics enabled (HPOS and legacy order storage are both supported)
  • Optional: a Google Gemini API key. Without one, questions are answered by the built-in rules and explanations are written by the plugin

Learn more

Frequently asked questions

The complete source code (version 1.0.0) as a download from your account, with the setup and usage guides shown on this page. It is free: sign in to download it.

More from this author

View all

Related in CMS Extensions

View all