=== CatalogDock — CSV Repair for WooCommerce ===
Contributors: drakkarwave
Tags: woocommerce, csv, import, variations, products
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 11.1
WC tested up to: 11.1
Stable tag: 0.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Donate link: https://catalogdock.org/

Checks product CSV files and Excel sheets for the built-in WooCommerce importer, fixes safe problems and gives you the complete corrected CSV.

== Description ==

The built-in WooCommerce product importer (Products → Import) often reports success even when variations lose their attributes or end up on an empty placeholder parent. This plugin checks the file before you import it.

**Everything is free, and your file is processed in your browser.** The file is read and checked in the admin page itself (a Web Worker); it is not uploaded to your server or anywhere else. All plugin features — checking, store comparison, price and stock update files, Excel picture uploads and the full corrected CSV — are free, with no account, license key or paid pass. Full corrected downloads are free, within the supported file limits (50,000 product records and 50 MB per file).

What it checks and does:

* Parent / variation links: missing, ambiguous or misspelled `Parent` SKUs, variations placed before their parent, parents that are not variable, links to other variations.
* SKUs: duplicates, SKUs that differ only in letter case or spaces.
* Attributes: variation values that the parent does not offer (`L` vs `Large`), attributes missing on the parent, duplicate combinations.
* Encoding and structure: UTF-8 only (other encodings are reported, never guessed), duplicate headers, broken quoting, up to 50,000 product records and 50 MB per file.
* Two safe automatic fixes: variations moved right after their parent, and outer spaces removed from `Parent` when the match is unambiguous. Nothing else is changed: SKUs, prices and attributes are never rewritten.
* The complete corrected CSV (with or without UTF-8 BOM), an HTML report, report.json and changes.csv.
* Excel workbooks (.xlsx, .xlsm): choose the sheet, header row and range; saved formula values are used, formulas are not recalculated, macros are never run.

With WooCommerce active, and only when you click the buttons:

* **Store catalog.** Reads the products and variations of your store through this site's REST API, page by page (ID, SKU, type, parent, attributes and terms, prices, stock and backorders). Then:
  * *Compare with the store*: rows the importer would skip because the SKU or ID already exists, variations whose parent is already in the store (attributes and values checked against that parent), global attributes and terms the import would create.
  * *Update prices and stock*: compares the file's SKUs with the catalog and prepares CSV files for Products → Import with "Update existing products" that contain only the changed prices and stock.
  The plugin never creates or changes products, attributes or terms itself.
* **Pictures embedded in an Excel sheet.** Pictures are linked to product rows by their position on the sheet. You choose which files to upload, confirm, and they are added to the media library one by one (each result is shown). The plugin then writes their media library URLs into the Images column of the corrected CSV and checks it again.

== Documentation & Links ==

* **Website & Online Checker:** [CatalogDock.org](https://catalogdock.org/) — check and prepare CSV or Excel files in your browser without installing anything.
* **Documentation:** [CatalogDock Documentation](https://catalogdock.org/docs) — technical specification, batch splitting, and import rules.
* **Troubleshooting Guides:** [WooCommerce Import Troubleshooting](https://catalogdock.org/docs/troubleshooting/invalid-or-duplicated-sku) — guides to invalid SKUs, unlinked variations, 504 timeouts, encoding, and images.
* **Support:** Email support@catalogdock.org or open a topic in the WordPress.org support forum.

== Installation ==

1. Upload the plugin ZIP under Plugins → Add New → Upload Plugin, and activate it.
2. Open Products → CatalogDock (Tools → CatalogDock if WooCommerce is not active).
3. Choose a CSV or Excel file and click "Check file".

== Screenshots ==

1. File check results and summary: parent/variation links, SKUs and attributes verified in your browser.
2. Compare your file with the store catalog and generate a CSV containing only changed prices.
3. Excel embedded pictures (DrawingML) extracted and linked to SKUs.

== Frequently Asked Questions ==

= Does the plugin send my file anywhere? =

No. The file is processed in your browser tab. The plugin itself makes no requests to external servers. The "About the checks" link on the plugin page opens the tool's website in a new tab only when you click it; nothing is loaded from it.

= What does the plugin store? =

Nothing, except when you upload pictures: they become normal media library attachments, each with a SHA-256 marker (post meta `_csvrepair_sha256`) so that uploading the same file again reuses the attachment instead of creating a duplicate. Uninstalling the plugin removes the markers and keeps the attachments.

= Who can use it? =

The page needs the `edit_products` capability (administrators and shop managers). Reading the catalog also needs `read_private_products`; uploading pictures needs `upload_files`. The REST routes check these capabilities themselves.

= Is a clean check a guarantee that the import will work? =

No. The rules follow the WooCommerce 11.1.2 importer source code and were confirmed with real imports, but other versions, settings and plugins were not tested. Import into a staging copy first.

= Why is the Excel sheet read this way? =

Values are taken as stored: text stays text (`007` stays `007`), numbers are written without exponent, dates as `YYYY-MM-DD`. Hidden rows are included unless you skip them, as in Excel's own CSV export.

= What is the difference between this plugin and the CatalogDock.org website? =

This WordPress plugin runs inside your WordPress admin dashboard (Products → CatalogDock). All its features are free, with no pass. Full corrected downloads are free, within the supported file limits (50,000 product records and 50 MB per file). After reading your store's catalog through this site's REST API, it compares the file with your store's products, global attributes and terms in the supported scenarios, and it can upload chosen Excel pictures to the Media Library.

The website [CatalogDock.org](https://catalogdock.org/) works in any browser, without WordPress or store access. The file is processed locally in the browser tab: once the checker has loaded, CSV checks keep working without a connection, but reading an Excel file, payment and restoring a purchase need the network. The website adds supplier file preparation (it recognizes supplier column headers in 12 languages; the interface is in English), building parents and variations from flat rows, saved supplier mappings, and import batches of about 500 records per file, which reduce the risk of server timeouts on large catalogs. It checks only the files you give it and cannot see your store's global attribute settings. On the website, the check and a sample of up to 50 records are free; large results use a one-time CatalogDock Pass.

= Where can I find documentation or get support? =

Detailed documentation and guides are available at [catalogdock.org/docs](https://catalogdock.org/docs). You can also reach our support team directly at support@catalogdock.org or use the WordPress.org support forum for this plugin.

== Privacy ==

The plugin does not contact external services, does not track anything and does not use cookies of its own. The checked files never leave the browser tab. Requests go only to this site's own REST API (the catalog, which the logged-in user can read anyway, and the pictures the user chose to upload). Uploaded pictures are publicly reachable at their media library URLs, like any other attachment.

== Source code and build ==

The JavaScript in `build/` is not minified. Its TypeScript sources and the build script are included in the `source/` folder of the plugin (see `source/BUILD.md`); the same code is used by the command-line version and the website of the tool.

Third-party code bundled in `build/worker.js` (license texts in `build/THIRD-PARTY-LICENSES.md`):

* SheetJS Community Edition (xlsx) 0.20.3 — Apache License 2.0 — https://sheetjs.com/
* csv-parse and csv-stringify — MIT — https://csv.js.org/
* buffer, base64-js — MIT; ieee754 — BSD-3-Clause

React and ReactDOM are not bundled: the plugin uses the copies that ship with WordPress.

== Changelog ==

= 0.1.1 =
* Aligned text domain with WordPress.org slug for localization.
* Corrected menu navigation path to Products → CatalogDock.
* Added documentation and support links.

= 0.1.0 =
* First version: file check with automatic fixes and the complete corrected CSV, Excel sheets, store catalogue comparison, price and stock update files, upload of embedded pictures to the media library with a CSV containing their URLs.
