=== Webgems Tile Manager for WooCommerce ===
Contributors: webgems,ipetru21
Tags: woocommerce, tiles, ceramics, flooring, price-per-m2
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

WooCommerce plugin for tile and flooring stores: price per m², sell per box, coverage calculator, country of origin badge.

== Description ==

**Webgems Tile Manager for WooCommerce** adds tile-specific pricing and display features to WooCommerce, designed for ceramic tile, flooring, and stone slab stores.

= Key Features =

* **Price per m²** — The product price is set as price per m². The plugin automatically calculates and displays the price per box on the product page.
* **Sell per box or per piece** — Quantity input represents boxes (or individual pieces). Cart totals reflect the correct box price × quantity.
* **Coverage calculator** — An interactive calculator on the product page lets customers enter the area to cover (in m²), add an overage percentage for cuts and breakage, and see how many boxes they need and the total cost.
* **Country of origin badge** — Optionally display a country badge (with flag) below the product title. Country is set per product. Enable/disable from plugin settings.
* **Pre-order support** — Products in backorder show a configurable "Pre-order" badge (text + color). A "Request quote" button replaces the add-to-cart button.
* **Flexible stock management** — Track stock in boxes, pieces, or m². The plugin shows the correct availability text and validates cart quantities accordingly.
* **Showroom button** — Display a button that opens a popup with links to navigate to your showroom via Waze, Google Maps, or Apple Maps. Configurable from plugin settings — works with any theme.
* **Woodmart theme compatible** — Full integration with the Woodmart theme: pre-order label in Woodmart's product label system, Woodmart wishlist-style showroom button, CSS variable support.

= How It Works =

1. Set the product price as price per m² in WooCommerce (Regular Price field).
2. Fill in the tile fields in the product editor: Tile size, Pieces per box, m² per box.
3. The plugin calculates and displays: price per box, coverage info, and the coverage calculator.
4. Customers add boxes to cart; totals are calculated correctly as price per box × quantity.

= Requirements =

* WordPress 5.8 or higher
* WooCommerce 6.0 or higher
* PHP 7.4 or higher

== Installation ==

1. Upload the `webgems-tile-manager-for-woocommerce` folder to the `/wp-content/plugins/` directory, or install via the WordPress plugin screen.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **WooCommerce → Tile Manager** to configure settings.
4. Edit any product, fill in the **Tile size**, **Pieces per box**, and **m² per box** fields in the product data panel.

== Frequently Asked Questions ==

= Does this plugin work with any WooCommerce theme? =

Yes. The core pricing and calculator features work with any theme. The showroom popup and pre-order features also work with any theme. There is optional enhanced compatibility with the Woodmart theme.

= How do I set the price per m²? =

Enter the price per m² in the standard WooCommerce "Regular Price" field. The plugin reads this value and calculates the price per box automatically using the m² per box value you set in the tile fields.

= Can I sell both per box and per piece? =

Yes. In the product tile fields, you can choose the stock measure: Boxes, Pieces, or m². When set to Pieces, the quantity input represents individual tiles and pricing is calculated per piece.

= What is the coverage calculator? =

An interactive tool displayed on the product page. Customers enter the area in m² they need to cover, choose an overage percentage (for cuts and breakage), and the calculator shows how many boxes are needed and the estimated cost.

= Can I show a country of origin badge? =

Yes. Enable "Country of Origin badge" in the plugin settings (WooCommerce → Tile Manager → Tile Data tab), then select the country for each product in the product editor. The badge displays the country flag and name below the product title.

= Does the showroom button work without the Woodmart theme? =

Yes. The showroom button and popup use the plugin's own CSS and JavaScript, with no dependency on any specific theme. Configure the showroom from WooCommerce → Tile Manager → Showroom tab.

= Where are the plugin settings? =

Go to **WooCommerce → Tile Manager** in the WordPress admin. There are two tabs: **Tile Data** (pricing, badge, pre-order settings) and **Showroom** (showroom button and popup configuration).

= Does uninstalling the plugin delete my product data? =

No. The plugin settings are removed on uninstall, but all tile meta data stored on products (tile size, m² per box, etc.) is left intact. This allows you to reactivate the plugin without losing your product data.

== Screenshots ==

1. Product page with price per m², box info block, and coverage calculator.
2. Coverage calculator open with area input and overage selection.
3. Plugin settings — Tile Data tab.
4. Plugin settings — Showroom tab.
5. Country of origin badge and coverage info below the product title.
6. Product editor — Tile fields panel.

== Development ==

This plugin is open source (GPLv2 or later). The admin settings page is built with [@wordpress/scripts](https://www.npmjs.com/package/@wordpress/scripts) (React / @wordpress/components). The complete, uncompiled source code is bundled in this package under the `/src` directory.

To rebuild the compiled assets in `assets/js/dist/`:

`npm install`
`npm run build`

The build uses `@wordpress/scripts` (webpack). No other build step is required; all other PHP, CSS, and JavaScript files are shipped uncompiled and human-readable.

== Changelog ==

= 1.4.0 =
* Changed: Plugin renamed to "Webgems Tile Manager for WooCommerce" with a distinctive, brand-prefixed name.
* Changed: All PHP classes, functions, constants, options, hooks, script handles, and post meta keys prefixed with WGTM_ / wgtm_ to avoid name collisions.
* Added: "Requires Plugins: woocommerce" header for WordPress plugin dependency support.
* Added: Uncompiled React source for the settings page bundled under /src, with documented build steps (see Development).

= 1.3.0 =
* New: React-based admin settings page using @wordpress/components — modern UI with sections, live badge preview, and collapsible advanced options.
* New: Romanian (ro_RO) translation — complete translation of all plugin strings including plural forms.

= 1.2.0 =
* New: Country of Origin badge — select country per product with flag display. Toggle from plugin settings.
* New: Showroom settings moved to plugin admin page — works with any theme, no Woodmart required.
* New: Self-contained showroom popup (vanilla JS, no Magnific Popup dependency).
* Changed: Default text values updated to English for international use (translatable via .pot file).
* Changed: WooCommerce attribute slugs updated to English (tile-size, pieces-per-box, m2-per-box).
* Removed: GitHub Updater — updates now delivered via WordPress.org.
* Removed: Contact Form 7 preorder field (too project-specific for a public plugin).

= 1.1.6 =
* Fix: Price per m² displayed correctly in cart (was showing price per box).

= 1.1.4 =
* Improvement: Pre-order badge style improved in product archives.

= 1.1.0 =
* Improvement: Pre-order selector CSS rewritten with Woodmart CSS variables for native theme integration.

= 1.0.2 =
* New: Pieces as a stock unit alongside boxes and m².
* New: Overage (waste) calculation in cart and pricing logic.
* New: Coverage calculator UI on product pages.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.4.0 =
Plugin renamed to "Webgems Tile Manager for WooCommerce" and all internal identifiers prefixed for WordPress.org compliance.

= 1.3.0 =
Settings page redesigned with a modern React-based UI — all your saved settings are preserved automatically.

= 1.2.0 =
Major update for public release. Showroom settings moved to plugin admin page (configure again after update). GitHub Updater and CF7 preorder field removed.
