=== FTMPUB Product Import from CSV ===
Contributors: ftmpub
Tags: woocommerce, product import, csv, bulk edit, seo
Requires at least: 5.9
Tested up to: 6.9
Stable tag: 1.0.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Bulk update WooCommerce product fields (descriptions, slug, SEO) from a CSV — with preview, selective apply, and one-click undo.

== Description ==

**FTMPUB Product Import from CSV** is the fastest way to bulk update WooCommerce product content using a simple CSV file — without touching the database directly and without risking data loss.

Upload your CSV, preview every row before applying, choose exactly which products to update, and roll back the entire operation with a single click if needed. Lightweight, secure, and fully compliant with WordPress coding standards.

**For full documentation, support, and the PRO version, visit [FTMPUB.ch](https://ftmpub.ch/ftmpub-product-import-from-csv-plugin-wordpress/).**

= Highlights =

* **Preview before import** — review every row before a single product is touched
* **Selective import** — check/uncheck individual rows or use Select All / None
* **One-click rollback** — instantly restore all modified products to their previous state
* **Auto-detect delimiter** — semicolon, comma, tab, or pipe detected automatically
* **Flexible product matching** — match by ID, SKU, Slug, or Auto (ID → SKU → Slug)
* **Post-import report** — updated / ignored / failed counts with per-row failure details
* **Downloadable CSV template** — prefilled with your product data structure
* **Multi-tab collision prevention** — unique session token per preview
* **Security-first** — nonces, capability checks, sanitized inputs, safe redirects
* **100% free** — no account required, no lock-in

= What you can update =

* **Short Description** (post excerpt)
* **Description** (post content, full HTML)
* **Slug** (URL key, auto-deduplicated by WordPress)
* **Yoast SEO Title** (`_yoast_wpseo_title`)
* **Yoast Meta Description** (`_yoast_wpseo_metadesc`)

= Who is it for? =

* SEO managers who need to update dozens or hundreds of product meta descriptions at once
* Catalogue managers importing content from an external PIM or spreadsheet
* Developers who need a safe, auditable bulk-edit tool for client sites
* Agencies managing multiple WooCommerce stores

= CSV Format =

Your CSV must contain at least one lookup column: **ID**, **SKU**, or **Slug**. All other columns are optional.

**Accepted column names (and aliases):**

| Canonical key       | Accepted aliases                                    |
|---------------------|-----------------------------------------------------|
| `id`                | `product_id`                                        |
| `sku`               | *(standard column name)*                            |
| `short_description` | `short`, `shortdesc`, `excerpt`                     |
| `description`       | `desc`, `content`                                   |
| `slug`              | `post_name`, `permalink`, `url_key`                 |
| `seo_title`         | `yoast_title`, `title_seo`                          |
| `meta_description`  | `yoast_metadesc`, `meta_desc`, `metadesc`           |

Column names are case-insensitive and accent-insensitive. Spaces and hyphens are treated as underscores.

Supported delimiters: `;` (semicolon), `,` (comma), `\t` (tab), `|` (pipe). Use **Auto (recommended)** to let the plugin detect automatically.

A downloadable CSV template with a sample row is available directly from the plugin interface.

= Limits =

* Maximum file size: **10 MB**
* Maximum rows loaded in preview: **20 000**
* Backup stored for up to **5 000 products** per import run
* Serialized preview data must not exceed **4 MB** (split large files if needed)

= Compatibility =

* Requires **WooCommerce** (tested up to WC 9.x)
* Compatible with **WooCommerce HPOS** (High-Performance Order Storage)
* Yoast SEO fields are updated if Yoast is active — no error if Yoast is not installed
* Compatible with WordPress multisite (per-site activation)

= Need more? =

Check out the **PRO version** on [FTMPUB.ch](https://ftmpub.ch/ftmpub-product-import-from-csv-plugin-wordpress/) — with support for additional fields (price, stock, categories, tags, images), batch AJAX processing, export to CSV, saved filter profiles, and full operation history log.

== Installation ==

= Automatic Installation =

1. In the WordPress admin, go to **Plugins → Add New**.
2. Search for **"FTMPUB Product Import from CSV"**.
3. Click **Install Now**, then **Activate**.
4. Go to **Tools → FTMPUB Product Import from CSV** and upload your first CSV.

= Manual Installation =

1. Download the plugin ZIP from [FTMPUB.ch](https://ftmpub.ch/ftmpub-product-import-from-csv-plugin-wordpress/) or WordPress.org.
2. Go to **Plugins → Add New → Upload Plugin**.
3. Upload the ZIP file and click **Activate**.
4. Go to **Tools → FTMPUB Product Import from CSV** to get started.

== Frequently Asked Questions ==

= Which CSV delimiters are supported? =

Semicolon (`;`), comma (`,`), tab (`\t`) and pipe (`|`). Choose **Auto (recommended)** to let the plugin detect the delimiter automatically by sampling the first 4 KB of the file.

= What happens if a product is not found? =

The row is counted as **ignored** and listed in the post-import failure report with the lookup key and reason. No data is modified for that row.

= Can I undo an import? =

Yes. The plugin saves a snapshot of the original field values before each import. Click **Undo last import** in the Security & Rollback panel to restore all affected products to their previous state in one click. The backup covers up to 5 000 products per run.

= Does it work without Yoast SEO? =

Yes. The SEO Title and Meta Description columns are simply ignored if Yoast SEO is not active. No error is thrown.

= Is WooCommerce required? =

Yes. The plugin checks for WooCommerce at activation and on every admin page load. A warning notice is displayed if WooCommerce is missing or inactive.

= How large can my CSV be? =

The upload limit is 10 MB and the preview loads up to 20 000 rows. For very large catalogues, split your CSV into multiple files.

= Where can I find documentation and support? =

Full documentation, tutorials, and support are available on [FTMPUB.ch](https://ftmpub.ch/ftmpub-product-import-from-csv-plugin-wordpress/).

== Screenshots ==

1. **CSV upload form** — Upload your CSV, choose the delimiter and the product match key (ID, SKU, Slug, or Auto).
2. **Preview table** — Review every row before importing. Rows without a valid product key are automatically disabled. Use Select All / None buttons to control the selection.
3. **Import result & rollback** — Green success notice after import with updated / ignored / error counts. The Security & Rollback panel shows the backup ready for one-click undo.

== Changelog ==

= 1.0.0 =
* Initial release
* Preview interface with row-level selection before import
* One-click rollback — full snapshot of modified fields before each run
* Auto-detect CSV delimiter (semicolon, comma, tab, pipe)
* Product matching by ID, SKU, Slug, or Auto (ID → SKU → Slug)
* Post-import report with per-row failure details
* Downloadable CSV template with sample row
* Multi-tab collision prevention via unique UUID session token
* Transient and option size guard — serialized size checked before write
* Failures array capped at 500 entries with truncation indicator
* WooCommerce HPOS compatibility declared
* Plugin Check (PHPCS) compliance: EscapeOutput, NonceVerification, AlternativeFunctions, InputNotSanitized, DiscouragedFunctions
* CSV parsing via SplFileObject (no direct fopen/fclose)
* Developer hooks: ftmpprim_column_aliases, ftmpprim_template_columns, ftmpprim_max_preview_rows, ftmpprim_import_row

== Upgrade Notice ==

= 1.0.0 =
Initial release — no upgrade needed.

== Support ==

Need help or want to upgrade to the **PRO version** with export, additional fields, and operation history?

👉 [FTMPUB Product Import from CSV — Plugin page](https://ftmpub.ch/ftmpub-product-import-from-csv-plugin-wordpress/)
👉 [FTMPUB.ch — WordPress plugins made in Switzerland](https://ftmpub.ch)
