=== Nexus Sales Tax Reports ===
Contributors: starlink1207
Tags: sales tax, economic nexus, woocommerce, tax report, csv
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Track US economic nexus thresholds per state and export sales tax summaries from your existing WooCommerce orders.

== Description ==

Nexus Sales Tax Reports helps US WooCommerce stores see where they are getting close to a state's economic nexus threshold and prepares a per-state sales tax summary from the order data you already have. It never calculates tax and never changes orders — it only reads stored shipping states, order totals, collected tax and refunds.

**Important:** this plugin is a reporting tool, not tax, legal or accounting advice. Thresholds and rules change and differ by state. Always confirm values with each state's tax authority or a tax professional.

= Nexus dashboard =

* All 50 states plus the District of Columbia with year-to-date sales and order counts.
* Sales and transaction thresholds per state (leave empty to ignore a criterion).
* Progress bars: amber at 70%, red at 100% of the threshold.
* States without a statewide sales tax (Alaska, Delaware, Montana, New Hampshire, Oregon) are shown as "Not applicable".
* Mark states where you are already registered.
* Prefilled reference defaults: $100,000 in most states, $500,000 for California, Texas and New York, $250,000 for Alabama and Mississippi. Transaction-count tests are not prefilled. Every value is editable, and the date the defaults were last reviewed is shown on screen.
* Select any state name to see the orders counted for it: order number (linked to the order), date, status, gross sales, tax and refunds, page by page.

= Threshold notices =

* When a state where you are not registered reaches 100% of a threshold, a notice appears on the WordPress dashboard and WooCommerce screens, for example "You may have economic nexus in Texas — $538k of $500k in sales".
* Each notice can be dismissed per state for the rest of the calendar year.

= Sales tax summary =

* Choose a month, quarter or year.
* Per state: orders, gross sales, taxable sales, tax collected, refunds, tax refunded, net taxable sales and net tax, with a totals row.
* Select a state to list the orders behind its figures.
* Reconciliation line: orders and gross sales counted in a US state versus all orders with the counted statuses in the period, so you can see that nothing is missing (international orders are shown separately).
* One-click CSV export.

= Settings =

* Choose which order statuses count (Completed and Processing by default).
* Choose gross sales or sales net of refunds as the nexus basis.
* Include or exclude shipping charges in the nexus sales total (included by default).
* Exclude orders with zero tax (exempt sales) from the nexus sales total and transaction count (included by default).

= Why this plugin =

* No account, sign-up or external service: nothing to connect and no API key.
* Your order data stays in your WordPress database; nothing is sent anywhere.
* No checkout code: the plugin only runs in the admin area, so it cannot slow down your cart or checkout.
* Built for large stores: orders are read with `wc_get_orders()` in batches, and lists are paginated, so the full order history is never loaded at once.
* Lightweight: no scripts or styles on public pages, settings read with a single query, and admin assets load only on the plugin's own screen (scripts deferred in the footer).
* Native admin look: standard WordPress tabs, notices, cards and tables, right-to-left friendly, with clear next steps when there is no data yet.
* Compatible with WooCommerce High-Performance Order Storage (HPOS).

The Pro version adds daily email alerts when a state approaches (at a percentage you choose) or exceeds a threshold, sent only once per event; a per-state measurement period (current calendar year, previous calendar year or rolling 12 months); other-channel sales (marketplaces, point of sale or another store) entered per state and month or imported from CSV and added to the nexus progress, with a setting for marketplace facilitator sales; a print-ready "Print / Save as PDF" view of the summary and copy buttons for each total; a filing detail report by tax rate broken down into state, county, city and district lines with partial refunds; a monthly CSV report emailed automatically; and cached aggregation for stores with many orders.

== Installation ==

1. Install and activate WooCommerce.
2. Upload the `nexus-sales-tax-reports` folder to `/wp-content/plugins/`, or install the plugin from the Plugins screen.
3. Activate the plugin.
4. Go to WooCommerce > Sales Tax Nexus. Review the thresholds on the Settings tab and mark the states where you are registered.

== Frequently Asked Questions ==

= Does this plugin calculate or collect sales tax? =

No. It only reads the totals, taxes and refunds already stored on your WooCommerce orders. Use WooCommerce tax settings or a tax service to calculate tax.

= Is this tax advice? =

No. The default thresholds are provided for reference only. Confirm the current rules with each state's tax authority or a qualified tax professional.

= Which address is used? =

The shipping state of the order. When an order has no shipping address, the billing state is used. Only US addresses are counted.

= Which orders are counted? =

Orders with the statuses you choose on the Settings tab (Completed and Processing by default). Refunds are applied to the period of the original order.

= Does it work with HPOS? =

Yes. The plugin uses WooCommerce order APIs only and declares HPOS compatibility.

= Does the plugin contact any external service? =

No. All data stays in your WordPress database.

= How can I check that no order is missing from the summary? =

Below the summary, the reconciliation line compares the orders counted in a US state with all orders that have the counted statuses in the period. Orders without a US shipping or billing state (for example international orders) are listed as not counted. Select a state name to see every order behind its row.

= Should shipping or exempt sales count toward the threshold? =

States differ. By default shipping charges and zero-tax orders are included, as in earlier versions. You can exclude either one on the Settings tab; the change applies to the nexus dashboard and threshold notices, while the sales tax summary still shows every counted order.

= How do I hide a threshold notice? =

Close it with the X button or use "Dismiss for" in the notice. It stays hidden for that state until the end of the calendar year. Marking the state as registered on the Settings tab also removes it.

= Does it slow down my store? =

No. The plugin adds nothing to the storefront, cart or checkout; it only reads orders when you open its admin screens, and it reads them in batches. On public pages it loads no CSS or JavaScript and reads its stored settings with at most one database query.

= The dashboard is empty. What should I do? =

The dashboard only counts orders shipped (or billed) to a US state with one of the counted order statuses in the current measurement period. Check the counted statuses on the Settings tab; the empty dashboard links there directly.

== Screenshots ==

1. Nexus dashboard: sales per state against each threshold, with approaching and exceeded states highlighted.
2. Sales tax summary per state for a month, quarter or year, with refunds netted out and CSV export.
3. Settings: order statuses, nexus basis and editable thresholds per state.
4. Orders counted for a state, linked to each order.

== Changelog ==

= 1.1.1 =
* Performance: options read on every request are loaded with a single query instead of one query each.
* Performance: admin CSS and JavaScript load only on the plugin's own screen; scripts use the defer strategy in the footer, and the period picker script only loads on the summary tab.
* Design: right-to-left friendly admin styles (logical properties, relative sizes), dashicons on the dashboard cards, keyboard focus styles and horizontally scrollable tables on small screens.
* Design: empty dashboard and summary now explain the next step and link to the counted order statuses.
* Pro: copy buttons announce "Copied" to screen readers.

= 1.1.0 =
* New: select a state on the dashboard or summary to list the orders counted for it (paginated, linked to each order).
* New: reconciliation line under the summary comparing counted orders with all orders in the counted statuses.
* New: dismissible notice when an unregistered state reaches 100% of a threshold, dismissed per state per year.
* New: nexus basis options to exclude shipping charges or zero-tax (exempt) orders. Defaults keep the previous behaviour.
* Pro: other-channel sales per state and month with CSV import, added to the nexus progress.
* Pro: Print / Save as PDF view of the summary and copy buttons for totals.

= 1.0.2 =
* Hardened output escaping, input sanitizing and database queries.
* 14-day free trial of Pro from the plugin screen.

= 1.0.1 =
* New York and Connecticut: progress requires both the sales and the transaction test.
* Clarified that transaction-count tests are not prefilled.

= 1.0.0 =
* Initial release.
