v0.3.1 — Status dashboard widget
What's new
OpenSalesTax health at-a-glance. The WP-admin home page now shows a compact dashboard widget below "At a Glance" with four signals merchants want to see every time they log in.
What the widget shows
| Signal | Possible values |
|---|---|
| Connection | OK (engine vX.Y, DB connected) / Unreachable / Not configured |
| Placeholder rate | OK (tax_rate_id = N) / Missing — re-activate the plugin |
| Orders today | count of orders with engine breakdown captured today |
| Quick actions | Configure (settings page) + View orders |
Implementation
- New class `OpenSalesTax\WooCommerce\DashboardWidget`
- Hooks `wp_dashboard_setup`; visibility gated on `manage_woocommerce` capability
- Health probe response cached 60s in a transient (`opensalestax_dashboard_health`) — the widget never hammers the engine
- HPOS-aware: queries `wp_wc_orders_meta` first, falls back to `wp_postmeta` for legacy CPT installs
- All output escaped via `esc_html` / `esc_attr` / `esc_url`
- All SQL via `$wpdb->prepare()` with `%s` placeholders
Verified end-to-end
On VM 907 against engine v0.36, the live `renderHtml()` produces a 1070-byte panel showing OK status, engine version, configured base URL, and per-day order count. Renders correctly under the capability check.
Quality gate
- 74/74 unit tests pass (5 new in `DashboardWidgetTest`: not-configured / healthy / unreachable / missing-placeholder / cached-health)
- PHPStan level=max clean
- PHP-CS-Fixer (PSR-12 + risky) clean
- Security review re-run for v0.3.1: capability check on `addWidget` ✓, SQL injection safe via `$wpdb->prepare(%s)` ✓, output escaping on every interpolated value ✓
Upgrade
Drop-in upgrade from v0.3.0 — no configuration required. The widget appears automatically on next admin page-load for users with `manage_woocommerce`.
```bash
cd wp-content/plugins/opensalestax-woocommerce
git pull
composer install --no-dev
```
Full changelog
See CHANGELOG.md.