=== PatchCart ===
Contributors: plugstera
Tags: woocommerce, products, bulk-edit, sku, gtin
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fix your catalog without fear. Find broken product data, see where it came from, repair it in bulk — previewed, snapshotted, reversible.

== Description ==

Every WooCommerce store older than a year carries product-data sediment: SKUs that were never set, sale schedules that ended months ago, variations customers can't actually buy, stock statuses that contradict the stock quantity, titles full of import junk. Fixing any of it in bulk is usually a leap of faith.

PatchCart is a **catalog operations** plugin. It closes the whole loop:

* **Detect** — 30+ checks across identifiers (SKU, GTIN/EAN/UPC), prices and sale schedules, stock, variations, images, categories, titles and descriptions, duplicates and slugs. Detection is never capped and results are never blurred: you always see everything we found.
* **Understand** — every finding explains *why it matters* and *how it gets fixed*, in plain language. A built-in Dictionary explains every piece of jargon (what's a GTIN? a variation? a snapshot?). The "Where values come from" screen shows every database location a value like your barcode number lives in — and which one your shop actually uses.
* **Repair** — bulk repair operations for missing SKUs, expired sale schedules, contradictory stock statuses, whitespace-damaged titles, variable products without a default choice, and variations whose options the parent product doesn't list. Repairs that generate or change customer-visible values ask you to review every row first — untick anything you'd rather leave alone.
* **Verify** — an operation isn't "done" when it runs; it's done when PatchCart re-checks every changed product and confirms the problem is gone. The result is shown to you, either way.
* **Prevent** — rules like "published products must have a SKU" or "sale price must be below regular price" watch every save, recording what fails and telling whoever saved. Start from ready-made templates, or write your own.

= The safety system =

PatchCart is built around one promise: **no repair is ever a leap of faith.**

* **Nothing is written during preview.** Every repair starts as a dry run — you see exact before → after values for every product before anything is touched.
* **Everything is snapshotted.** Before a single value is written, PatchCart saves a copy of every field it will touch, checksummed for integrity.
* **Everything can be rolled back.** The Roll back button doesn't expire. If a product was edited by someone else *after* your repair, rollback skips it and tells you — it never silently overwrites newer work.
* **Everything is verified.** After applying, every changed product is re-checked automatically; anything still wrong is reported honestly.
* **Everything is logged.** A tamper-evident audit log records who ran what, when, on how many products, and how it ended.

**Safety is never the upsell.** Preview, snapshots, rollback, verification and the audit log are part of every repair this plugin performs.

= Free vs Pro =

This plugin is not a trial and contains no artificial limits: nothing in it is capped, downgraded or switched off waiting for a licence. Every check runs over your whole catalog, every repair it ships covers everything it finds in one run, and you can have as many rules as you like.

PatchCart Pro is a separate add-on (sold on plugstera.com, a one-time payment rather than a subscription) that **adds** capabilities: deep cleanups for orphaned data, detection and repair of barcodes that differ between plugins, Block-publish enforcement for rules, scans on a schedule with an email digest, and optional text drafting with your own AI provider key. Those features are code that ships with the add-on — install it and they appear; don't, and this plugin behaves exactly as documented above.

This plugin does not require an account and works entirely on your own server; the only time it contacts plugstera.com is if you choose to enter a Pro license key.

= For developers =

* Full WP-CLI support: `wp patchcart scan run`, `findings list`, `explain`, `op preview|apply|rollback`, `lineage`, `rules`, `audit verify-chain` and more.
* Reads are direct, indexed SQL; writes go through the WooCommerce CRUD so your hooks and integrations keep firing.
* Extension hooks for registering your own detectors, operations and data sources.
* HPOS-compatible. Background work runs on Action Scheduler in its own queue group.

PatchCart performs automated product-data checks. It does not replace a manual accessibility audit, legal compliance review or professional SEO strategy.

== Installation ==

1. Install and activate WooCommerce (8.5 or newer).
2. Install PatchCart from the Plugins screen and activate it.
3. Open **PatchCart** in the admin menu and run your first scan. The scan is read-only — nothing changes until you preview and apply a repair yourself.

== Frequently Asked Questions ==

= Does PatchCart change anything without asking? =

No. Scans are read-only. Every repair starts with a preview that writes nothing, shows you exact before → after values, and waits for you to press Apply. Nothing is ever auto-applied.

= What if a fix turns out to be wrong? =

Roll it back. Every repair keeps a checksummed snapshot of every value it touched, and the Roll back button doesn't expire. Products edited by someone else after your repair are skipped and reported instead of overwritten.

= Will it slow down my storefront? =

No. PatchCart does its heavy work in background batches on Action Scheduler and loads its interface only on its own admin page. Your storefront pages don't run PatchCart code.

= I have a large catalog. Will it cope? =

PatchCart is developed and tested against catalogs of 10,000+ products with batched, resumable background scans. Repairs process in chunks and survive interruptions.

= Is the free version a trial? =

No. It never expires, and nothing in it is limited by a licence — no capped runs, no capped rules, no feature quietly downgraded until you pay. The paid add-on adds features; it does not unlock this plugin.

= Does it phone home? =

The plugin runs entirely on your server. It contacts plugstera.com only if you choose to activate a Pro license key, and then only to validate that key.

= Is this legal or compliance advice? =

No. PatchCart checks whether product data is present and consistent. It never certifies compliance with any law or standard.

== Screenshots ==

1. Dashboard — catalog health score, what needs attention, and recent repairs.
2. Findings — every problem type, filterable by severity, category and fixability.
3. A finding explained — why it matters, which products are affected, and the one-click path to the repair.
4. Repair preview — exact before → after values, nothing written until you apply.
5. Per-row review — untick any product you'd rather leave alone.
6. Verified result — every changed product re-checked, with a persistent Roll back button.
7. Rules — ready-made templates, each set to Monitor or Warn.
8. Where values come from — every storage location for a field, and which one wins.
9. Dictionary — every term explained in plain language.

== Changelog ==

= 0.1.0 =
* Initial release: detection engine (30+ checks), six bulk repair operations with preview / snapshot / verify / rollback, rules that check every save, field lineage v1, health score, Dictionary, WP-CLI.
