=== MetriPrice – Measurement Price Calculator & Product Configurator for WooCommerce ===
Contributors: metriprice
Tags: woocommerce, calculator, price calculator, measurement pricing, cost calculator
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Measurement & formula based price calculators for WooCommerce — wallpaper, flooring, fabric by the meter and any made-to-measure product.

== Description ==

MetriPrice adds measurement-driven price calculators to WooCommerce products. Shoppers enter dimensions (width × height, length, area) in metric or imperial units; the plugin computes the price on the server with your formula, waste percentage, roll/box rounding, tiered prices or a width×height price matrix — and shows it as a live, line-by-line receipt.

**Built for measurement-heavy stores:**

* Wallpaper — price per m² with roll rounding and cutting waste
* Flooring — box coverage rounding with underlay extras
* Fabric, curtains, blinds — linear meters with cutting margin
* Glass, signage, countertops — any width × height pricing

**12 field types:** quantity (with −/+ stepper), dimension (with unit selector and ft+in compound input), text (with character counter), checkbox, radio, toggle, dropdown, range slider, live summary card, HTML block, divider, total display. Choice options can carry color swatches and per-option prices.

**Everything in this plugin is fully functional — nothing is locked:**

* Formula engine with a safe whitelist parser — no eval, ever
* Four pricing modes: per-unit, tiered (bracket or graduated), free-form formula, width×height price matrix
* Metric ↔ imperial unit conversion (canonical server-side units)
* Waste percentage + ceil-to-roll/box rounding + minimum quantity
* Server is the only price authority: the browser never computes or submits a price — only raw measurements travel
* Live receipt summary with per-field amounts (exact in unit mode, marginal repricing elsewhere)
* Product, category or store-wide calculator assignment; inline or "Customize" modal display
* "Edit measurements" from the cart (classic cart and Cart Block); every cart line is re-priced server-side on every load
* Per-field styling basics (label and input colors, sizes, accent and choice colors, alignment) plus storefront text overrides
* Visual admin builder with live preview, click-to-style, 50-step undo; guided setup wizard and interactive tour
* 3 ready-made templates (wallpaper, flooring, fabric) installable from the gallery with full demo product-page previews
* Import/export, duplicate, automatic backups (last 3 saves)
* Cart & Checkout Blocks compatible; HPOS compatible
* Shortcode `[pcfg_calculator id="1"]`, Gutenberg block, Elementor widget, WPBakery element, Contact Form 7 tag
* WPML/Polylang string translation bridge; ships with English and 100% Turkish

== MetriPrice Pro ==

MetriPrice Pro is a separate plugin sold on [metriprice.com](https://metriprice.com) — it is not part of this download. It adds: 15 advanced field types (image choices, date/time, secure file upload, geolocation, repeaters, groups, multi-step wizard, formula element, visual design editor, companion products, lead form), conditional logic, discounts & promo codes, quote requests with PDF/e-mail/SMS delivery and open tracking, standalone checkout (Stripe incl. subscriptions, PayPal, cash) with a single-rate tax line, an orders dashboard, funnel analytics, signed webhooks, reCAPTCHA v3, an AI drafting assistant, a multi-currency bridge, a sticky floating calculator button, price blur/hide for lead capture, variation-aware pricing with the product's own price as a formula variable, the detailed per-field styling toolkit and 25 additional industry templates.

== External services ==

This plugin bundles the Freemius SDK, which powers optional usage tracking, in-dashboard upgrades to MetriPrice Pro and licensing for Pro customers.

* **What it is and why:** Freemius is a licensing and distribution platform for WordPress plugins. It renders this plugin's Upgrade/Pricing pages and, only if you explicitly opt in on the activation screen, collects diagnostic data to help us support you.
* **What is sent and when:** Nothing is sent unless you opt in. If you opt in, Freemius receives your site URL, WordPress/PHP versions, plugin version and the administrator's e-mail address, on activation and on periodic update checks. Declining the opt-in leaves the plugin fully functional.
* **Links:** [Freemius Terms of Service](https://freemius.com/terms/) · [Freemius Privacy Policy](https://freemius.com/privacy/)

No other external service is contacted by this plugin.

== Frequently Asked Questions ==

= Is anything in this plugin locked or limited? =

No. Everything that ships in this plugin works without a license key, account or time limit. MetriPrice Pro is a separate plugin distributed from metriprice.com — this download does not contain locked Pro code.

= Does it work without WooCommerce? =

The calculator, shortcode and block work on any page. Add-to-cart pricing requires WooCommerce.

= Can shoppers manipulate the price from the browser? =

No. The browser only sends raw inputs ({value, unit} pairs). Every price is recalculated on the server when adding to cart AND on every cart total calculation. Tampered cart sessions are detected and the item is removed.

= Does the free plugin send any data anywhere? =

Only if you explicitly opt in to Freemius diagnostics on the activation screen (see "External services" above). The pricing engine itself never calls out — all calculations run on your own server.

= If I upgrade to Pro, do I keep my calculators? =

Yes. Pro installs over the free version and uses the same database tables and settings; nothing is migrated or lost.

= How are the per-field amounts in the live summary calculated? =

In unit-price mode they are exact (quantity × unit price). With a custom price formula each amount is marginal: the server re-prices the calculator without that field and shows the difference — "what the total would lose". For non-linear formulas those amounts intentionally do not add up to the total.

= Anything to tune for high-traffic sites? =

The REST rate limiter stores its counters in transients. On busy sites a persistent object cache (Redis or Memcached) is recommended so those counters live in memory instead of hitting the database on every request.

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

Yes. All order operations use WooCommerce CRUD.

== Source Code & Build ==

The JavaScript bundles in `assets/admin/build/` and `assets/frontend/build/` are compiled with @wordpress/scripts. The non-compiled, human-readable sources ship inside this plugin at `assets/admin/src/` and `assets/frontend/src/`. To rebuild: `npm install && npm run build`.

== Screenshots ==

1. Visual builder — field palette, canvas, inspector and a live customer preview beside the editor
2. Template gallery — ready-made templates with category filters, live preview and one-click install
3. Calculator embedded on a WooCommerce product page with a live receipt summary
4. Guided setup wizard — fields, pricing and appearance with a live preview at every step
5. Appearance styling — accent, colors and per-field basics tuned live
6. Template preview as a full demo product page — install-free look at a template before adding it

== Changelog ==

= 0.2.0 =
* Packaging rework: this wp.org package contains only fully functional code — nothing in it is locked, time-limited or license-gated. MetriPrice Pro is a separate plugin distributed from metriprice.com and is not included here.
* Template gallery tells the whole truth: the three bundled templates install with every field and setting intact, their feature badges are derived from the actual template content, and Pro templates appear only as an external "live demos" link — never as locked cards.
* Removed: the experimental Custom CSS box (use your theme's Additional CSS with the `[data-pcfg-field]` selectors instead).
* Inline preview styles/scripts moved to the WordPress enqueue API; hardened input sanitization.
* New "External services" readme section documenting the bundled (opt-in) Freemius SDK.

= 0.1.0 =
* Initial release of the calculator core: whitelist formula engine, metric/imperial unit conversion, waste & roll rounding, unit/tiered/formula pricing, product/category calculator assignment, cart/order integration (HPOS + Cart & Checkout Blocks), live receipt-style summary, GDPR export/erase, WPML/Polylang bridge, visual admin builder with undo, Gutenberg block. (Advanced features later split into the separate MetriPrice Pro plugin.)
