=== Flexa Extra ===
Contributors: flexatech
Tags: woocommerce, product options, extra product options, product addons, personalization
Requires at least: 5.0
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 6.0.0
WC tested up to: 11.0.0
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Extra product options for WooCommerce: text, choices, swatches, buttons, date and colour pickers, plus optional per-option fees priced server-side.

== Description ==

Flexa Extra lets you attach extra option fields to WooCommerce products so shoppers can personalize what they buy and you can charge for it. Build an **Option Set** once, assign it to products (all, a hand-picked list, or by category/tag/price/stock conditions), and the fields appear on the product page with live price updates.

Every price is recomputed on the server from your saved field definitions when the product is added to the cart — a client-submitted price is never trusted — so the amount a shopper pays always matches what you configured.

= Field types (free) =

* Text, textarea, number (with min/max/step and email/URL/regex validation)
* Date picker and colour picker
* Checkbox, radio, dropdown
* Colour/image swatches
* Button group
* Heading / description block
* Minimum and maximum number of choices on any multi-select field

= Pricing =

* Per-field or per-option surcharge
* Fixed amount or a percentage of the product price
* Conditional fees and discounts applied to the item when selections match a rule

= Inventory =

* Optional stock limit per choice option: sold-out options are disabled, over-selling is blocked at add-to-cart, and paid orders draw the stock down (restored on cancel or refund)

= Templates =

* Start from a template: pick a ready-made starter (gift wrapping, engraving, size & colour, installation service, warranty plan, product add-ons) and it creates a draft option set you can edit before publishing

= Assignment & logic =

* Target all products, a manual list, or conditions (category, tag, product, price, stock)
* Conditional logic to show/hide fields based on other selections
* Duplicate an option set, and import or export sets as a JSON file

= Cart =

* Edit a line's options straight from the cart: the product page reopens with the
  saved selections filled in, and re-adding replaces the line instead of stacking a
  duplicate

= Display & accessibility =

* Position fields before or after the add-to-cart button
* Live "extra subtotal" and "total price" readouts
* Itemized price breakdown: each selected option and conditional fee/discount listed with its own price, updating live
* Swatch size/shape and button colour styling
* Accessible markup (fieldset/legend groups, `aria-required`, keyboard focus), responsive, and reduced-motion aware

== Installation ==

1. Upload the plugin to `/wp-content/plugins/flexa-extra` or install it through the Plugins screen.
2. Activate it. WooCommerce must be active.
3. On activation a short quick-start guide points you at the template gallery so you can build your first Option Set in a couple of minutes. It is skippable, and you can replay it later from Advanced settings.
4. Open **Flexa Extra** in the admin menu to configure settings and build Option Sets.

== Frequently Asked Questions ==

= Does it require WooCommerce? =

Yes. Flexa Extra stays inactive (with an admin notice) until WooCommerce is active.

= Can a customer tamper with the surcharge? =

No. The extra price is recomputed server-side from your stored option definitions on add-to-cart and on every cart totals pass; the posted values are sanitized against the field schema.

= Is it compatible with High-Performance Order Storage (HPOS)? =

Yes. The plugin declares HPOS compatibility.

= Can developers extend it? =

Yes — see `docs/HOOKS.md` for the available actions and filters.

== Source code for compiled JavaScript and CSS ==

The admin app ships as a compiled bundle in `assets/dist/admin/`. The
human-readable source is included in this package under `apps/admin/src/`
(with its build config) and is built with pnpm + Vite:

1. `cd apps/admin`
2. `pnpm install`
3. `pnpm build`   (or `pnpm dev` for a watched dev build)

The storefront assets in `assets/frontend/` are plain, unminified JS/CSS and need
no build step.

== External services ==

This plugin does not connect to any external services. All data is stored locally in your WordPress database.

== Changelog ==

= 1.0.1 =
* Security: escape swatch image URLs for the CSS `url()` context on the product page and in the cart, preventing CSS injection through crafted URLs.
* Removed the "Tested up to" line from the main plugin file so compatibility is declared only in readme.txt.

= 1.0.0 =
* Initial release: option-set builder with text, number, date picker, colour picker, choice, swatch and button fields; storefront render engine; server-authoritative pricing/cart engine; UX & style settings; and a two-tier automated test suite.

== Upgrade Notice ==

= 1.0.1 =
Hardens swatch image output against CSS injection. Recommended update.

= 1.0.0 =
Initial release.
