=== LIO Product Units ===
Tags: woocommerce, weight, quantity, measurements, price
Requires at least: 7.1
Tested up to: 7.1
Requires PHP: 8.2
Requires Plugins: woocommerce
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sell simple WooCommerce products by kilogram, gram, meter, centimeter, square meter, cubic meter, liter or piece.

== Description ==

LIO Product Units uses WooCommerce's native product price, cart quantity, tax, coupon, stock and order APIs. Price and stock must be entered per selected sales unit, or per physical whole box when optional box coverage is enabled. Four-place decimal step and quantity limits are enforced on the server.

Free features:
* Kg, g, m, cm, m2, m3, l and pcs.
* Four-decimal quantity precision.
* Configurable minimum, maximum (zero = unlimited), step.
* Validation on classic cart and modern Store API.
* RU/EN interface.
* Mobile accessible quantity controls and immediate non-authoritative estimated total.
* Optional whole-box coverage by square meters for simple products (no fractional boxes).
* No tracking, license key or external SaaS.

LIO Product Units 1.0.0 is the first standalone Free release. WooCommerce 11.2, HPOS, Classic/Store API, Cart/Checkout Blocks, taxes, coupons and mobile flows passed isolated automated and native-browser administration tests. The WP Desk Flexible Quantity plugin is incompatible; test other third-party plugins on a staging copy before deploying to a live shop. Not yet listed on WordPress.org.

== Installation ==

1. Upload the plugin directory into wp-content/plugins or install its ZIP.
2. Activate WooCommerce 11.2 or newer.
3. Open a simple product and use Product data > General > LIO Product Units.
4. Enable the checkbox, select the sales unit, then set minimum, maximum and step.
5. Enter WooCommerce price per selected unit and stock in the same unit. Shipping weight uses WooCommerce's separate shipping-weight field.

== Whole-box coverage (Free 1.1.0) ==

For a simple product sold in complete boxes, enable LIO Product Units, choose sales unit pcs, minimum 1, step 1, and enter the square meter coverage per box (e.g. 1.23) in the optional field. Enter the WooCommerce product price per physical box and available stock in whole boxes, not m².

A shopper requesting 2.46 m² needs 2 boxes; requesting 2.47 m² needs 3 boxes. The product-page estimate is informational: WooCommerce owns cart prices, taxes, coupons and stock. Only the integer box quantity is submitted. The cart shows actual covered m². Orders record immutable m² coverage per box rather than an aggregate that could go stale on manual order edits/refunds. The exact requested area is not saved in the order.

Only simple products with whole-box step 1 are supported. Changes to product coverage or prices invalidate outdated cart terms. These Free features do not require Pro or a license key. This GitHub stable release is not yet submitted to WordPress.org.

== Frequently Asked Questions ==

= Does this change prices or stock of existing products? =
No. Only products explicitly enabled by an administrator are handled. The plugin uses WooCommerce's native price and stock fields.

= Does it work with variable products? =
Not in Free 1.0.0. Existing variable products continue to use standard WooCommerce behavior.

= Can I change the unit from kg to g later? =
Existing price and stock are not automatically converted. Update both carefully before changing units.

= How do I remove my data? =
By default, uninstalling leaves settings unchanged. Enable the deletion preference under WooCommerce > Product Units before uninstalling to delete only this plugin's product settings. Order records are preserved.

= What happens if a price or unit setting changes while an item is in the cart? =
LIO Product Units checks the catalog price, selected unit, minimum, maximum and step that applied when a measured product was added. If these change, the outdated item is removed when the cart is restored and an explanation appears. The shopper can add the product again to accept current terms. This does not silently charge the old price or submit a changed quantity. Ordinary WooCommerce items are unaffected.

= Have shipping and inventory extensions been tested? =
Basic isolated WooCommerce Cart/Store API, order, fractional stock/refund and shipping package checks passed with ATUM Inventory Management 2.0.7 and Weight Based Shipping for WooCommerce 6.20.0 installed, both separately and together. ATUM Stock Central advanced operations remain unverified; basic configured Weight Based Shipping 6.20.0 tier rates were tested successfully. Always verify on a staging copy before enabling third-party integrations in a real shop.

= Can Flexible Quantity (WP Desk) be active at the same time? =
Not currently. Flexible Quantity 2.3.24 was tested against our measured products and rejected fractional Store API quantities. LIO Product Units shows a warning to administrators when both plugins are active. Deactivate one of the two before taking measured orders.

= Are client-side price estimates authoritative? =
No. WooCommerce recalculates all totals server-side.

== Screenshots ==

1. Mobile simple-product page showing a decimal quantity selector and server-independent estimated total.
2. Mobile WooCommerce Cart Block showing the 1.25 kg quantity, unit metadata and line total.
3. Mobile Checkout Block retaining the fractional quantity and the order total.

== Changelog ==

= 1.1.0 =
* Free whole-box coverage for simple products: request m², automatically round up to whole boxes; WooCommerce catalog price, stock, tax, coupons and refunds stay authoritative per box.
* Accessible + / − quantity controls, input validation, visible min/step/max and immediate client estimate; no client-supplied price accepted.
* Whole-box item and immutable per-box coverage metadata work with Cart/Checkout Blocks, Store API, native order editing, physical delivery and partial refunds.
* PHP 8.2–8.5, WordPress Coding Standards, Plugin Check, isolated full integration and native browser Cart/Checkout QA passed. Validated on LIOSFERA QA without changing other plugins.
* No WordPress.org publication in this release.

= 1.1.0-rc.1 =
* P5.1 release candidate: physical box shipping and native Woo order-item editing regression coverage, isolated localhost and shared QA acceptance.

= 1.1.0-dev.2 =
* Opt-in area coverage by whole boxes for simple products. WooCommerce catalog price and stock remain per physical box.
* Requested square meters round up to whole boxes using exact four-decimal math; cart, Store API, taxes and refunds continue to use server-owned box quantity.
* Experimental development only, not a stable or WordPress.org release.


= 1.1.0-dev.1 =
* Development preview only, not a stable release: accessible quantity buttons, immediate price estimate, visible limits and inline input errors for simple measured products.
* WooCommerce remains authoritative for line totals and order validation. Test in isolation before any public upgrade.

= 1.0.1 =
* Strict storefront price estimate matches the server four-decimal quantity input and step validation. WooCommerce continues to calculate the authoritative price.
* Confirmed on isolated WooCommerce 11.2 QA with native Cart/Checkout Blocks, HPOS, tax, coupons, refunds and browser tests at 360 px.
* Confirmed against the private LIOSFERA WooCommerce 11.2.1 QA shop: 20 Store API assertions and a reversible fractional-order test, with temporary data removed.
* PHP 8.2–8.5 regression checks, WordPress Coding Standards and Plugin Check passed. No WordPress.org publication in this release.

= 1.0.1-rc.1 =
* Private patch candidate: storefront estimate now applies the same strict four-place quantity input grammar and integer step grid as server validation.
* Hide estimates for scientific notation, comma decimals, extra precision, invalid steps or floating overflow. Actual WooCommerce totals remain authoritative.
* Added thirty dependency-free frontend regression checks and isolated release-gate QA. Not yet submitted to WordPress.org.

= 1.0.0 =
* First standalone Free release by LIOSFERA, GPLv2-or-later, no external license or tracking.
* Decimal quantities by weight, length, area, volume or pieces on simple WooCommerce products.
* HPOS and Cart/Checkout Blocks, native stock/price/coupon/tax/refund handling.
* Administrator editor verified through standard authenticated WordPress browser login on isolated QA; settings persistence, validation and mobile editing tested.
* GitHub Actions PHP 8.2–8.5 and WordPress Coding Standards green; WP Plugin Check clean.
* Known incompatibility with WP Desk Flexible Quantity remains; advanced integrations require staging verification.

= 1.0.0-rc.1 =
* Internal Release Candidate for independently tested WooCommerce decimal sales; not published to WordPress.org.
* Compatibility declared for HPOS and Cart/Checkout Blocks after real isolated integration tests.
* Improved recovery when product prices or measurement settings change while in cart.
* Four-decimal quantity, native WooCommerce taxes/coupons/stock, mixed carts, refunds, mobile Cart/Checkout and Russian translations.
* Known incompatibility: WP Desk Flexible Quantity 2.3.24. Authenticated editor browser QA and hosted GitHub CI remain open release gates.

= 0.1.0-dev (P3.4) =
* Mark measured cart lines with server-owned catalog price and unit-setting fingerprints.
* Safely remove obsolete saved cart lines and show an actionable notice on Cart Blocks.
* Clear only the obsolete notice after successful re-addition; preserve other plugin notices.
* Tested changes to price, max quantity, sales unit and enabled state using live Store API and mobile Chromium.


= 0.1.0-dev =
* Prevent background product saves without editor fields from disabling measured sales.
* Verify normal uninstall data retention and optional cleanup in isolated WordPress.
* Initial simple-product measured quantity implementation, validation, translated UI and order metadata.
* Real WooCommerce checkout, HPOS, fraction-safe stock and mobile Blocks tested in isolated QA; known third-party conflicts documented.
