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

**Website and live demo:** https://wearlook.vercel.app — try the fitting room yourself before installing.

https://www.youtube.com/watch?v=NI3wj4DPnzU

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** — Wearlook measures the visitor's shoulders and scales the garment to them, and if the product photo is shot on a model it cuts the garment off the model first. They can still drag, resize and rotate to perfect the fit, press **Auto-fit** to go back to the measured placement, 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.

== Local body detection ==

The free preview uses bundled MediaPipe Tasks Vision 0.10.32 and the Pose Landmarker Lite model. Model files are downloaded from your own WordPress site when a shopper prepares a photo. The photo is processed on their device, not sent to Google. No API key or server GPU is required for this preview. If the browser blocks the model or no reliable single-person pose is found, the shopper can place the garment manually.

For best results, use one front-facing person with both shoulders visible, and a flat-lay product image. The preview is a movable image overlay, not a clothing-size recommendation or a photorealistic clothing replacement. On-model product extraction is approximate and may retain unwanted parts of complex product photos. Photorealistic replacement still requires a configured AI provider.

Third-party runtime source and license: see assets/vendor/mediapipe/NOTICE.txt and LICENSE.

== 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? =
Wearlook reads the visitor's photo, separates them from the background and measures their shoulders, then scales the garment to that measurement and hangs it from their shoulder line — so the same garment comes out larger on a close-up selfie and smaller on a full-length photo. The visitor can still fine-tune with drag and the size/rotate sliders. All of it runs in their browser; nothing is uploaded.

If the photo is unusual — a busy background, or the head cropped out of frame — Wearlook says so to itself and falls back to a sensible fixed placement rather than guessing. The sliders are always there, and the **Auto-fit** button re-runs the automatic placement at any time, so no amount of dragging is a dead end.

A new photo is always fitted automatically. Switching to another product image keeps the size and rotation already dialled in, so comparing two colourways on yourself stays one tap — press Auto-fit if you would rather start that image fresh.

= My product photos are shot on a model, not laid flat. Does that work? =
Yes. When Wearlook finds a person in the product photo it cuts the garment out of it — the model's head, arms and trousers are removed and only the garment is placed on the visitor. Flat-lay photos are used as they are, with the studio background knocked out.

= 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.4.1 =
* Bundled on-device shoulder/hip landmark detection for automatic alignment, including busy backgrounds. No external model service or API key is needed for the free preview.
* Clear manual-adjustment guidance when a single person's landmarks cannot be confidently detected.
* Fixed stale image loads overwriting the selected colour or reappearing after closing the fitting room.
* Reset photo consent between sessions, preserve drag adjustments across image changes, and release downloaded image URLs.
* Align tilted garments around the collar and use measured hip positions for the bottoms setting.


= 1.4.0 =
* Automatic fitting now measures the visitor. Wearlook separates them from the background, finds their shoulders and scales the garment to that width instead of always using a fixed fraction of the photo — so a close-up selfie and a full-length photo both come out right.
* Product photos shot on a model are handled properly. The garment is cut out of the model photo — head, arms and trousers removed — instead of the whole model being pasted onto the visitor.
* Studio padding around a product photo is trimmed, so the garment is sized by its own edges rather than by the whitespace around it.
* New **Auto-fit** button. Drag the garment or move the sliders as much as you like, then
  press Auto-fit to snap straight back to the measured placement.
* Drag, size and rotate are unchanged and still available on every fit.
* When a photo cannot be read confidently — busy background, head out of frame — the previous fixed placement is used rather than a bad guess.

= 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.4.1 =
Improved automatic alignment and photo-session reliability. The ZIP includes the local body-detection model; allow about 27 MB of disk space and a larger first-use download. Modern browsers with WebAssembly are recommended. Manual adjustment remains available if the model cannot load.


= 1.4.0 =
Recommended. The fitting room now measures the shopper's shoulders and scales the garment to them, and cuts the garment out of on-model product photos instead of pasting the whole model. Also adds the image picker and optional AI renders with your own API key. Settings are kept.

= 1.3.2 =
Recommended. Adds the product image picker — shoppers choose which photo to try on, including colour variations — plus optional AI renders with your own Gemini, FASHN.ai or fal.ai key. Settings are kept.

= 1.3.1 =
Recommended. Includes the product image picker added in 1.2.0 and the bring-your-own-AI-key engines added in 1.3.0.

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