=== PersoNailit ===
Contributors: RideHome
Tags: woocommerce, product personalization, product options, custom fields, file upload
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 9.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add configurable personalization fields — text, image upload, color and box swatches, with optional per-value pricing and combinations — to any WooCommerce product.

== Description ==

PersoNailit adds a "PersoNailit" tab to the WooCommerce product data panel,
letting store owners attach one or more personalization elements to any
simple or variable product:

* **Text** — a free-text field with max length, allowed-character
  restrictions (letters only / numbers only) and text transform (uppercase,
  lowercase, capitalize). Can carry its own extra price.
* **Image Upload** — single or multiple file upload, with configurable
  maximum size and allowed file types (PNG, JPG, GIF, PDF). Can carry its
  own extra price.
* **Color Swatches** — a repeater of clickable colors, each with its own
  optional price, sale price, stock status, weight/dimensions, reference and
  preview image.
* **Box Swatches** — a repeater of clickable boxes (text or image), with the
  same per-value price, sale price, stock, shipping and reference options as
  Color, plus a configurable size (Small/Medium/Large) and an option to
  display the price inside the box itself.

Each element can be marked as required. Submitted values are validated on
add-to-cart, shown in the cart and stored as order item meta, so store
owners see exactly what the customer requested on every order.

= Combinations =

Available on simple products only (see the FAQ below for why). When a
product has two or more Color/Box elements, PersoNailit can generate every
combination of their values automatically ("Generate Combinations"). Each
combination can then be given its own price, sale price, image, stock
status, weight and dimensions — overriding the individual color/box values
for that specific pairing. Bulk actions are available to set price, stock
status, weight or dimensions across several combinations at once.

= Out of stock handling =

Colors, boxes and combinations can each be marked as out of stock. The
storefront automatically blocks "Add to cart" and shows a message when the
customer's current selection (or active combination) is unavailable.

= Element Sets =

A product's configured elements can be saved as a reusable "set" from the
product panel, then added to any other product in one click — useful when
several products share the same personalization style.

= Global Settings & Element Settings =

Two admin screens (under the main PersoNailit menu) let store owners:

* customize the personalization box's appearance (background color, accent
  color, title, padding, border radius) and whether new elements are
  required by default — **Global Settings**;
* set global defaults per element type (placeholder text, default file
  types and size, default swatch size, default box size, etc.), used
  whenever a product doesn't override them — **Element Settings**.

Uploaded files are stored in a temporary, `.htaccess`-protected directory
until checkout completes, then moved to a final protected directory and
attached to the order. Unclaimed temporary uploads are deleted automatically
after 3 days.

= Extending PersoNailit =

Developers can register additional element types without modifying plugin
files, by dropping a class implementing `PersoNailit_Element_Interface`
into `includes/elements/{type}/class-element-{type}.php`, or by hooking into
the `personailit_elements` filter to register/remove elements
programmatically. See `docs/hooks.md` for the full list of available hooks.

== Installation ==

1. Make sure WooCommerce is installed and active.
2. Upload the `personailit` folder to `/wp-content/plugins/`, or install
   the zip via **Plugins → Add New → Upload Plugin**.
3. Activate the plugin through the **Plugins** screen.
4. Edit any product, open the **PersoNailit** tab, check **Enable
   PersoNailit** and add one or more elements.
5. Optional: visit the **PersoNailit** admin menu to configure global
   appearance and per-element defaults before adding elements to products.

== Frequently Asked Questions ==

= Does this work with variable products? =

Yes, the PersoNailit tab and all personalization elements (Text, Image,
Color, Box) are available on both simple and variable products.

Combinations specifically are only available on simple products.
WooCommerce's own variations already provide per-variation price, stock
and image, so on a variable product you'd have two systems trying to
control the same thing with no clean rule for which one should win. On a
variable product, personalize with individual Color/Box elements
alongside your WooCommerce variations instead.

= What's the difference between an element's own price and a combination's price? =

Each color or box can have its own price/sale price, used as-is when the
product has fewer than two combinable elements (or Combinations isn't
enabled). Once Combinations is active and a matching combination has a
price set, that combination's price takes over for that specific pairing.

= What happens to uploaded files if the order is abandoned? =

Files uploaded but never used in a completed order are stored in a
temporary directory and are automatically deleted after 3 days by a
scheduled cleanup task.

= Can I reuse the same set of elements across several products? =

Yes — use "Save Element Set" on any product's PersoNailit tab, then "Add
Set" on any other product to apply it.

= Can I add my own element type? =

Yes — see "Extending PersoNailit" above.

= Why isn't SVG offered as an allowed file type for image uploads? =

It's intentionally left out. SVG files can embed executable content (e.g.
`<script>` tags), so accepting them from customers safely requires
sanitizing the file first — support may be added in a future version once
that sanitization step is in place.

== Changelog ==

= 1.0.0 =
* Text, Image Upload, Color Swatches and Box Swatches elements.
* Combinations: auto-generated combos of Color/Box values with their own
  price, sale price, image, stock, weight and dimensions, plus bulk
  actions.
* Out of stock handling for individual values and combinations.
* Element Sets: save and reuse a product's element configuration.
* Global Settings and Element Settings admin screens.
* Cart and order integration with per-element validation.
* Temporary/final upload handling with automatic cleanup.

== Upgrade Notice ==

= 1.0.0 =
Initial release.