v0.3.0 — Per-order jurisdiction breakdown view
What's new
Per-order tax breakdown panel. Every order created at checkout now stores the engine's full per-jurisdiction tax breakdown — state, county, city, and special districts — and renders it as a clean table on the WooCommerce admin order-edit page.
Why this matters
US sales tax in destination-based states is rarely "just one rate." A $100 cart shipping to Minneapolis hits 6 jurisdictions at once:
| Type | Jurisdiction | Rate | Tax |
|---|---|---|---|
| state | Minnesota | 6.875% | $6.88 |
| county | Hennepin County | 0.150% | $0.15 |
| city | Minneapolis | 0.500% | $0.50 |
| district | Hennepin County Transit Sales Tax | 0.500% | $0.50 |
| district | Metro Area Transportation Sales Tax | 0.750% | $0.75 |
| district | Metro Area Sales and Use Tax for Housing | 0.250% | $0.25 |
| 9.025% | $9.03 |
TaxJar / Avalara show one flat "Tax: $9.03." OpenSalesTax shows you exactly where every penny went — useful for audit reconciliation, customer transparency, and answering "is this right?" without leaving WooCommerce.
How it works
- New class
OpenSalesTax\WooCommerce\OrderTaxBreakdown - Hooks
woocommerce_checkout_create_order(priority 20) — re-calls the engine with the final order destination + line items, serializes the result, persists as order meta_opensalestax_breakdown(JSON) - Hooks
woocommerce_admin_order_data_after_order_details— renders the breakdown table on the admin order page - Public accessor
OrderTaxBreakdown::get(WC_Order $order): ?arrayfor accounting integrations - Failures here are non-fatal — checkout proceeds even if the breakdown call fails (the headline tax was already computed via the calc filter in v0.1)
Programmatic access
wp eval '$o = wc_get_order(123); print_r(OpenSalesTax\WooCommerce\OrderTaxBreakdown::get($o));'Verified end-to-end
On Proxmox VM 907 against engine v0.36, ZIP 55401: created a WC_Order with a $100 product, captured the breakdown, decoded the meta. Six jurisdictions, $9.025 total — exactly matching what the calc filter charged.
Quality gate
- 69/69 unit tests pass (12 new in
OrderTaxBreakdownTest) - PHPStan level=max clean
- PHP-CS-Fixer (PSR-12 + risky) clean
- Security review re-run for v0.3: every interpolated value escapes via
esc_html()/esc_html__(). The XSS-defense test installs a realhtmlspecialcharscallback viaWP_Mock::userFunctionso the test isn't self-defeating.
Upgrade
Drop-in upgrade from v0.2.0 — no configuration required. Existing orders will not retroactively gain the breakdown panel (the meta is captured at order-create time); new orders going forward will.
cd wp-content/plugins/opensalestax-woocommerce
git pull
composer install --no-devFull changelog
See CHANGELOG.md.