=== Wearlook – Virtual Try-On Fitting Room for WooCommerce ===
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.3.2
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.

**Bring your own AI (optional)**

* Choose **Google Gemini**, **FASHN.ai** or **fal.ai** and paste your own API key — renders are billed to you by that provider, at their prices (both are paid services; expect a few cents per image).
* fal.ai lets you pick between several try-on models, so you can trade cost against quality.
* Or point the plugin at a **Wearlook Cloud** server.
* Leave the engine on **None** and the plugin stays completely free, with no external calls at all.

**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.

AI renders are **off by default**. They only happen if the site owner chooses an AI engine under Settings → Virtual Try-On and enters their own API key. Whichever engine is chosen, the plugin sends the visitor's uploaded photo, the garment image and the garment category to that service, only when a visitor clicks the "AI render" button after ticking the consent checkbox. The API key is stored in this site's database.

**Google Gemini** — used when the "Google Gemini" engine is selected. Requests go to `https://generativelanguage.googleapis.com`, authenticated with the site owner's Google API key.
Terms: https://ai.google.dev/gemini-api/terms · Privacy: https://policies.google.com/privacy

**FASHN.ai** — used when the "FASHN.ai" engine is selected. Requests go to `https://api.fashn.ai`, authenticated with the site owner's FASHN.ai API key.
Terms: https://fashn.ai/terms · Privacy: https://fashn.ai/privacy

**fal.ai** — used when the "fal.ai" engine is selected. Requests go to `https://fal.run`, authenticated with the site owner's fal.ai API key. fal.ai hosts several try-on models; the one you select in settings is the one contacted.
Terms: https://fal.ai/terms · Privacy: https://fal.ai/privacy

**Wearlook Cloud** — used when the "Wearlook Cloud" engine is selected. Requests go to the API server URL the site owner configures, authenticated with their Wearlook Cloud API key. This service is provided by the plugin author; its terms and privacy policy are shown in the Wearlook Cloud dashboard.

No AI service is contacted while the engine is set to "None" — the free fitting room runs entirely in the visitor's browser.

== 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 use my own AI API key? =
Yes. Under Settings → Virtual Try-On pick **Google Gemini** or **FASHN.ai** as the AI engine and paste your own key. Renders are billed to you directly by that provider, and the plugin adds no fee. Your key is stored in this site's database.

= Which AI engine should I choose? =
fal.ai is the most flexible: one key gives you a choice of purpose-built try-on models, so you can pick a cheaper or a higher-quality one from the settings dropdown.
Google Gemini is usually the cheapest per image and the key takes a minute to create in Google AI Studio. FASHN.ai is purpose-built for garment try-on.

**Both are paid services.** AI image generation is not included in Google's free API tier, so your Google account needs billing enabled; FASHN.ai is likewise a paid API. Expect roughly a few cents per render. Check each provider's current pricing before enabling renders on a busy store, and use the "AI renders per visitor per hour" limit to cap what visitors can spend on your behalf. If you would rather not pay anything, leave the engine on **None** — the fitting room stays free and unlimited.

= 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; connect your own AI key only if you want photorealistic renders.
5. One tap on another thumbnail tries the same garment in a different colourway, keeping the visitor's photo and fit.

== Changelog ==

= 1.3.2 =
* Plugin title now describes what it does, so shops can find it by searching. Same plugin, same settings, nothing to change.

= 1.3.1 =
* Plugin author details updated. No functional changes.

= 1.3.0 =
* Bring your own AI key: choose **Google Gemini**, **FASHN.ai** or **fal.ai** as the render engine and pay that provider directly — no Wearlook account needed.
* fal.ai gives a choice of try-on models (FASHN v1.6, Kling Kolors v1.5) so you can trade cost against quality.
* New "AI engine" selector; only the key field for the chosen engine is shown.
* Clear provider error messages are passed through (for example an invalid API key now says so).
* Existing sites using a Wearlook Cloud URL and key keep working exactly as before.

= 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.3.2 =
Display name only — no functional changes.

= 1.3.1 =
Author details only — nothing to do.

= 1.3.0 =
You can now connect your own Google Gemini, FASHN.ai or fal.ai API key for photorealistic renders. Existing setups are unaffected.

= 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.
