=== RDP Auto SKU Generator ===
Contributors: rawdogplugins
Tags: sku, woocommerce, product, inventory, generator
Requires at least: 5.6
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically generate unique SKUs for WooCommerce products using category-based prefixes or custom prefixes you define.

== Description ==

**Auto SKU Generator** takes the hassle out of creating SKUs for your WooCommerce products. Instead of manually typing a SKU for every product, this plugin automatically generates structured, unique SKUs based on your product's category and ID.

= How It Works =

When you create or save a WooCommerce product without a SKU, Auto SKU Generator automatically assigns one using a consistent format:

**[Prefix][Product ID][Suffix]**

* The **prefix** is derived from the product's category ID (zero-padded to 3 digits) or a custom prefix you define per category.
* The **product ID** portion is zero-padded to fill the remaining SKU length.
* A trailing digit is appended to ensure uniqueness in case of collisions.

= Features =

* **Automatic SKU assignment** — Products saved without a SKU get one automatically.
* **Two prefix modes** — Use the category ID as a prefix, or define your own custom prefix for each category.
* **Configurable SKU length** — Set your preferred total SKU length between 8 and 20 characters.
* **Live SKU preview** — A suggested SKU appears below the SKU field on the product edit screen, updating in real time as you change categories.
* **Click-to-insert** — Click the suggested SKU to instantly populate the SKU field.
* **Collision handling** — If a generated SKU already exists, the plugin automatically tries alternative suffixes.
* **Settings page** — Configure everything from Products > Auto SKU Generator in your WordPress admin.
* **Clean uninstall** — All plugin data is removed when you delete the plugin.

= Use Cases =

* Online stores with large product catalogs that need consistent SKU formatting.
* Shops where multiple team members add products and you want standardized SKUs.
* Stores migrating from another platform that need to establish a new SKU system.
* Any WooCommerce store that wants to save time on manual SKU entry.

= Requirements =

* WordPress 5.6 or higher
* WooCommerce 5.0 or higher
* PHP 7.4 or higher

== Installation ==

1. Upload the `auto-sku-generator` folder to the `/wp-content/plugins/` directory, or install the plugin through the WordPress Plugins screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Go to **Products > Auto SKU Generator** to configure your settings.
4. Choose your prefix mode (Category ID or User-Defined) and set your preferred SKU length.
5. Start creating products — SKUs will be generated automatically!

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. Auto SKU Generator is built specifically for WooCommerce and requires WooCommerce 5.0 or higher to function.

= Will it overwrite my existing SKUs? =

No. The plugin only generates a SKU when a product is saved without one. If a product already has a SKU, it is left untouched.

= What happens if the generated SKU already exists? =

The plugin automatically appends a different trailing digit (0-9) to find a unique SKU. This prevents duplicate SKU errors.

= Can I use my own custom prefixes instead of category IDs? =

Yes. On the settings page (Products > Auto SKU Generator), switch to "User-Defined Prefixes" mode and enter a custom alphanumeric prefix for each product category.

= What format are the generated SKUs? =

SKUs follow the pattern: [Prefix][Zero-padded Product ID][Suffix digit]. For example, with category ID mode and a SKU length of 13, product ID 42 in category 5 would get a SKU like `005000000420`.

= Can I change the SKU length? =

Yes. You can set the total SKU length anywhere from 8 to 20 characters on the settings page.

= What happens when I delete the plugin? =

All plugin settings are removed from your database. Your product SKUs remain unchanged since they are part of the product data, not the plugin settings.

= Does it work with variable products? =

The plugin generates SKUs for the parent product. Variation SKUs are managed through WooCommerce's built-in variation system.

= Is the plugin compatible with the block editor? =

Yes. The plugin works with both the classic WooCommerce product editor and the block-based product editor.

== Screenshots ==

1. Settings page showing prefix mode options and SKU length configuration.
2. Product edit screen with the live SKU suggestion and click-to-insert feature.
3. User-defined prefix configuration with per-category custom prefixes.

== Changelog ==

= 1.0.0 =
* Initial release.
* Automatic SKU generation on product save.
* Category ID prefix mode.
* User-defined prefix mode with per-category configuration.
* Configurable SKU length (8-20 characters).
* Live SKU suggestion on product edit screen.
* Click-to-insert functionality.
* Collision detection with automatic suffix rotation.
* Settings page under Products menu.
* Clean uninstall support.

== Upgrade Notice ==

= 1.0.0 =
Initial release of Auto SKU Generator. Install to start generating automatic SKUs for your WooCommerce products.
