=== A1 Profit Reports for WooCommerce === Contributors: a1plugins, freemius Tags: woocommerce, cost of goods, profit, margin, reporting Requires at least: 6.0 Tested up to: 7.0 Requires PHP: 7.4 WC requires at least: 9.5 WC tested up to: 10.9 Stable tag: 1.2.10 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Profit tracking for WooCommerce, built on WooCommerce's native Cost of Goods Sold field — profit columns, order margins, and a date-range report. == Description == A1 Profit Reports for WooCommerce adds the reporting layer WooCommerce's own Cost of Goods Sold feature doesn't provide: * Sortable Profit and Margin columns on the product list. * A Profit row on every order, and a Profit column on the orders list — refund-aware. * A date-range Cost of Goods report: summary cards, a per-product profit breakdown, and CSV export. * Quick-select date presets (Last 30 Days, This Month, This Quarter, Last Quarter, This Year, Last Year). * A tool to recalculate historical cost for orders that predate Cost of Goods tracking. * Configurable order statuses for what counts as a sale in reports. This plugin reads and writes cost data through WooCommerce's own Cost of Goods Sold field (`WC_Product::get_cogs_value()` / `get_cogs_total_value()`), so cost entry, Quick Edit, and Bulk Edit all work the way they already do in WooCommerce — this plugin doesn't duplicate that, it reports on top of it. = Requirements = * WooCommerce 9.5 or newer (this plugin reports on top of WooCommerce's own native Cost of Goods Sold field, which isn't available on older versions). * WooCommerce's Cost of Goods Sold feature must be enabled (WooCommerce → Settings → Advanced → Features). The plugin turns this on automatically on activation. = Scale = Not recommended for stores exceeding roughly 10,000 sales/month, particularly when using wide date ranges like "This Year" — report data is cached, but a first-time computation over a very large order volume can still be slow. == Installation == 1. Upload the plugin files to `/wp-content/plugins/a1-profit-reports-for-woocommerce`, or install through the WordPress admin's Plugins screen. 2. Activate the plugin. This automatically enables WooCommerce's Cost of Goods Sold feature if it isn't already on. 3. Set a cost on your products (Product data → Pricing, or via Quick Edit / Bulk Edit). 4. Find your report under WooCommerce → Cost of Goods. == Frequently Asked Questions == = Why don't I see cost data on old orders? = Orders placed before the Cost of Goods feature was enabled never had a cost snapshotted. Use the "Recalculate Historical Cost for This Range" button on the report page — it applies each product's *current* cost retroactively. This is an approximation, not a historical record: if a product's cost has changed since the sale, the recalculated value won't match what it actually cost at the time. = Why is the report missing cost for some products? = The report flags products sold in the period that currently have no Cost of Goods value set. They're counted at $0 cost until you add one. == Changelog == = 1.2.10 = * Fix: clicking "Allow & Continue" on Freemius's opt-in screen (1.2.9's fix) connected successfully but then redirected back to the same "Sorry, you are not allowed to access this page" error — confirmed live on wp.org. Freemius treats this plugin's Account page raw slug as its permanent "default page" and redirects back to it immediately after both "Allow & Continue" and "Skip" complete, not just during the initial pre-connection click that 1.2.9 fixed. The placeholder page from 1.2.9 is now registered unconditionally (instead of only pre-connection) so that slug always resolves; it's hidden from the WooCommerce submenu once actually connected (registered with no visible parent, the same technique Freemius's own SDK uses for its hidden activation page) so there's still no duplicate "A1 Profit" menu item, and it now redirects straight to the real Account page instead of the report page when already connected. = 1.2.9 = * Fix: activating the plugin and clicking Freemius's "Opt In" banner/link led to a fatal "Sorry, you are not allowed to access this page" error for every new customer, instead of the license/connect screen — confirmed live on wp.org. Root cause: this plugin's Freemius Account page nests under WooCommerce's top-level menu (rather than owning its own top-level menu, unlike A1-WooBay), and Freemius's SDK only knows how to take over an *already-registered* submenu page at that slug during the pre-connection activation flow — it has no fallback to create one from scratch the way it does for top-level menus. Since nothing in this plugin ever registered that page, "Opt In" pointed nowhere. Fixed by registering a placeholder submenu page at that exact slug for Freemius to take over, matching A1-WooBay's working pattern; also confirmed this covers the same error recurring immediately after clicking "Skip" (a second, related gap), and that it doesn't create a duplicate menu item once actually connected. = 1.2.8 = * Fix: `Plugin URI` in the plugin header still pointed at the pre-rename `/a1-woocog/` URL (404, flagged in wp.org review round 2) — now points to `/a1-profit-reports-for-woocommerce/`. * Add: `Requires Plugins: woocommerce` header, per the reviewer's optional suggestion. * Fix: the (Pro-only) report page's date-preset `