=== Wearlook ===
Contributors: gopalbogati
Tags: virtual try-on, fitting room, ai, fashion, woocommerce
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A free virtual fitting room for any WordPress site. Visitors try clothes on their own photo — automatically fitted, right in their browser.

== Description ==

Wearlook gives every WordPress site a virtual fitting room — no account, no signup, free forever:

1. A visitor clicks **Try It On** and uploads a photo of themselves. **The photo never leaves their browser.**
2. If the product has more than one photo, they **choose which image to try on** — a different angle, or a different colour.
3. The garment is **fitted onto their photo automatically** — the background is removed and it is placed on the upper body. They can drag, resize and rotate to perfect the fit, then download the look.
4. *(Optional premium)* Businesses can connect a Wearlook Cloud account to add an **AI render** button that produces a photorealistic image of the garment on the visitor's body.

**Works everywhere**

* **Any WordPress site** — add `[wearlook]` to any page or post with a featured image, or point it at any media-library image: `[wearlook image="123"]`
* **WooCommerce (optional)** — the button appears automatically on every product page with a featured image. Per-product disable checkbox included.
* Blogs, portfolios, lookbooks, boutiques, designers — anywhere clothes are shown.

**Choose the image to try on**

* Products with several photos show a thumbnail strip at the top of the try-on window.
* It offers the featured image, the full product gallery, and — on variable products — the variation images, so a shopper can try the same garment in another colourway.
* Switching image keeps their uploaded photo and the fit they have already set, so comparing two colours on themselves takes a single tap.
* Products with a single image are unchanged: no picker, no extra clicks.

**Free vs premium**

* **Free (everyone):** unlimited in-browser fitting room, automatic garment placement and background removal, download-your-look. Zero configuration, zero data collection.
* **Premium (businesses):** photorealistic AI renders via Wearlook Cloud credits, with a consent checkbox and per-visitor rate limiting to protect your balance.

== External services ==

The **free fitting room sends nothing anywhere** — it runs entirely in the visitor's browser.

If (and only if) a site owner connects the optional premium service, the plugin talks to the **Wearlook Cloud API** (the URL configured under Settings → Virtual Try-On) to generate photorealistic AI try-on images.

* **What is sent:** the visitor's uploaded photo, the garment image, and the garment category, authenticated with the site's API key.
* **When it is sent:** only when a visitor clicks the "AI render" button after ticking the consent checkbox.
* **What happens to the data:** photos are processed in memory to produce the render and are not stored by the service.

This service is provided by the plugin author. Terms of service and privacy policy are available on the service website shown in your Wearlook Cloud dashboard.

== Installation ==

1. Upload the plugin ZIP via Plugins → Add New → Upload, and activate it.
2. That's it — on WooCommerce product pages the button appears automatically. On any other page, add the `[wearlook]` shortcode (uses the featured image) or `[wearlook image="123"]`.
3. *(Optional premium)* Go to **Settings → Virtual Try-On** and enter your Wearlook Cloud API URL and key to enable photorealistic AI renders.

== Frequently Asked Questions ==

= Does it need WooCommerce? =
No. It works on any WordPress site via the `[wearlook]` shortcode. If WooCommerce is active, product pages get the button automatically.

= Is it really free? =
Yes — the fitting room (automatic garment placement, drag/resize/rotate, download) is free and unlimited with no account. Only the optional photorealistic AI render uses a paid Wearlook Cloud subscription.

= Do visitor photos leave their device? =
Not in the free fitting room — everything runs in the visitor's browser. A photo is only transmitted (over HTTPS, after explicit consent) when the visitor requests a premium AI render, and it is processed in memory, never stored.

= How does the automatic fitting work? =
The plugin removes the garment photo's background (works best on white/light product shots) and places it on the upper body of the visitor's photo. The visitor fine-tunes with drag and sliders.

= Can I use any image as the garment? =
Yes — `[wearlook image="URL-or-attachment-ID"]` works with any image in your media library. Pass several, separated by commas, to let the visitor choose: `[wearlook image="12,13,14"]`.

= Can the visitor choose which product image to try on? =
Yes. When a product has more than one image, a thumbnail strip appears at the top of the try-on window. It offers the featured image, the product gallery, and the variation images of variable products — so a visitor can try the same garment in another colour or from another angle. Switching images keeps their uploaded photo and current fit, and the choice is validated server-side against that product's own images.

= Can I disable it for some WooCommerce products? =
Yes — every product has a "Disable virtual try-on" checkbox under Product data → Advanced.

= How do I stop one visitor using all my AI credits? =
Premium renders have a per-visitor hourly rate limit, configurable in settings (default: 10 per hour).

== Screenshots ==

1. The "Try It On" button appears automatically on WooCommerce product pages.
2. The free fitting room — the garment is placed on the visitor's photo automatically; drag, resize and rotate to fit. Products with several photos show a picker along the top.
3. Works on any WordPress site with the [wearlook] shortcode — no WooCommerce needed.
4. Settings → Virtual Try-On — the fitting room works out of the box; premium AI renders are optional.
5. One tap on another thumbnail tries the same garment in a different colourway, keeping the visitor's photo and fit.

== Changelog ==

= 1.2.0 =
* Visitors can now choose which product image to try on, instead of always getting the first one. Requested by a store owner selling garments photographed from several angles and in several colours.
* The picker offers the featured image, the product gallery, and — on variable products — the variation images, so colourways can be tried on directly.
* Switching image keeps the uploaded photo and the current size/rotation, so comparing colours is one click.
* The shortcode accepts a list: `[wearlook image="12,13,14"]`.
* The chosen image is validated server-side against that product's own images.

= 1.1.1 =
* Camera photos, including browser-decodable HEIC images, are resized and converted to JPEG before AI upload.
* White garment details are preserved more reliably during browser background removal.
* Failed AI-provider requests no longer consume a visitor's hourly allowance.

= 1.1.0 =
* Works on every WordPress site — WooCommerce is now optional.
* New `[wearlook]` shortcode: featured image, attachment ID, or image URL.
* Free tier needs zero configuration; premium AI section only appears when a cloud account is connected.
* Settings moved to Settings → Virtual Try-On.
* Multiple try-on buttons per page supported.

= 1.0.0 =
* First release: fitting room with automatic garment placement, optional AI renders, consent checkbox, per-visitor rate limiting, per-product disable.

== Upgrade Notice ==

= 1.2.0 =
Visitors can now pick which product image to try on — gallery images and variation colourways included.

= 1.1.1 =
Improves camera image compatibility and prevents temporary AI failures from consuming a visitor's allowance.

= 1.1.0 =
Wearlook now works on every WordPress site (WooCommerce optional) and adds the [wearlook] shortcode.
