=== aisthetix Virtual Try-On ===
Contributors: aisthetix
Tags: woocommerce, virtual try-on, fashion, ai, fitting room
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI virtual try-on for WooCommerce fashion stores. Shoppers see how a garment looks on them before they buy. One-click connect, no keys to copy.

== Description ==

aisthetix adds an AI-powered virtual try-on to your WooCommerce product pages. A shopper uploads a photo of themselves, and the garment on the page is rendered onto their body in seconds — a virtual fitting room that lifts conversion and cuts returns.

This plugin is a thin, free connector to the hosted aisthetix service. It does not run AI on your server: the shopper's browser talks directly to the aisthetix service, so your store stays fast and your PHP workers are never tied up on multi-second AI calls.

**Highlights**

* One-click **Connect aisthetix** — sign in (Google or email code), approve, done. No API keys to copy or paste.
* Works on **simple and variable products** — the try-on follows the selected variation's image automatically.
* **Multiple placements**: automatic (after the Add to cart button), a `[aisthetix_tryon]` shortcode, a Gutenberg block, and a native Elementor widget.
* **Optimizer-friendly**: the loader is registered so it is not delayed or stripped by WP Rocket, LiteSpeed Cache, or Perfmatters.
* **Localized**: includes English and Italian, follows your site locale.
* **Hides itself when paused**: when the store's monthly quota is reached, the try-on entry point simply disappears — no broken button, no nag.

== Privacy & GDPR ==

Your shoppers' privacy is central to this product.

* **Shopper photos are processed transiently and are never stored.** The photo is uploaded from the shopper's browser directly to the aisthetix service, used only to generate the try-on image, and is not persisted.
* **Photos never touch your WordPress server.** WordPress only injects a small configuration object and a loader script; the image upload and the result both flow between the shopper's browser and the aisthetix service.
* The shopper's uploaded photo and their try-on history live **only in their own browser's local storage**.
* The plugin stores, on your server, two API keys provisioned during Connect: a public (publishable) key that is safe to expose to the browser and a secret key that is used only for server-to-server status checks and is never sent to the browser.

A full privacy disclosure and Data Processing Agreement are available on the aisthetix dashboard. Use of this plugin sends shopper-provided images to the third-party aisthetix service for processing; you should reflect this in your store's privacy policy.

== External services ==

This plugin connects your store to the aisthetix virtual try-on service (the "brain", hosted at woo.aisthetix.fyi). The service is required: the AI try-on is provided remotely and does not run on your WordPress server.

What is sent, and when:

* Shopper photo + garment image — sent from the shopper's browser to https://woo.aisthetix.fyi/api/storefront/tryon, only when the shopper actively starts a try-on (an explicit click, behind the widget's own consent step). The photo is processed transiently to generate the result and is not stored by the service; it lives only in the shopper's own browser storage.
* Connection details — when you (the merchant) click "Connect aisthetix", your site URL, a return URL, and a state token are sent to https://woo.aisthetix.fyi/connect and /api/connect/* to link your store and provision keys. Merchant-initiated.
* Anonymous analytics events (product_viewed, product_added_to_cart, aisthetix_tryon_completed) — sent to https://woo.aisthetix.fyi/api/events ONLY if you enable "Anonymous analytics" (off by default) or a consent banner on your site grants analytics/statistics consent. See "Cookies & consent" below.
* Order data (order id, product ids, order value, currency, and an anonymous visitor/customer id) — sent to https://woo.aisthetix.fyi/api/storefront/order when an order is paid, ONLY if "Anonymous analytics" is enabled. Used to attribute purchases to prior try-ons.

Service Terms of Service: https://tryon-demo.aisthetix.com/woocommerce/terms
Service Privacy Policy: https://tryon-demo.aisthetix.com/woocommerce/privacy

== Cookies & consent ==

By default this plugin sets NO cookies and sends NO analytics — nothing is tracked passively. The shopper-initiated try-on still works: it is an explicit action, not passive tracking.

If you enable "Anonymous analytics" under WooCommerce -> aisthetix Try-On (off by default), the plugin:

* Sets a first-party cookie named "aisthetix_vid" on product pages — a random, non-personal visitor id used to attribute a later purchase to an earlier try-on. It is not a login or credential cookie. Lifetime: about 13 months.
* Sends the anonymous analytics and order events described under "External services".

If your site uses a supported consent banner (Cookiebot, Complianz, or Google Consent Mode), the shopper's analytics/statistics choice additionally controls the browser-side events: an explicit grant enables them and an explicit deny suppresses them, regardless of the setting. The first-party cookie and the server-side order event follow the "Anonymous analytics" setting.

== Build from source ==

The storefront widget (assets/widget.js + assets/widget.css) is built from the React + TypeScript source shipped in widget-src/. To reproduce it:

`cd widget-src && npm ci && npm run build`

This emits assets/widget.js and assets/widget.css. See widget-src/BUILD.md for details. All widget runtime dependencies are MIT-licensed (React, React DOM).

== Installation ==

1. Install and activate **WooCommerce** (required).
2. Install and activate **aisthetix Virtual Try-On**.
3. Go to **WooCommerce -> aisthetix Try-On** and click **Connect aisthetix**.
4. Sign in (Google or a 6-digit email code), approve the connection, and choose a plan.
5. The try-on button now appears on your product pages. Adjust placement under the same settings page, or use the `[aisthetix_tryon]` shortcode / Gutenberg block / Elementor widget anywhere you like.

== Frequently Asked Questions ==

= Does this require WooCommerce? =
Yes. The plugin declares WooCommerce as a required plugin and will not run without it.

= Where are shopper photos stored? =
They are not stored. Photos are processed transiently by the aisthetix service and live only in the shopper's own browser storage. They never reach your WordPress server.

= Does it work with variable products? =
Yes. When a shopper selects a variation, the garment image used for the try-on switches to that variation's image automatically.

= Will my caching / optimization plugin break it? =
The loader is deliberately tiny and is registered as an exclusion for WP Rocket, LiteSpeed Cache, and Perfmatters so it is not delayed or stripped. If you use a different optimizer, exclude `assets/bootstrap.js` from JS delay/defer.

= What happens when the monthly quota runs out? =
The try-on entry point simply disappears from the storefront until the quota resets — there is no broken button and no upsell shown to shoppers. Quota and billing are managed on the aisthetix dashboard.

== Screenshots ==

1. The try-on button on a product page.
2. The upload-your-photo step.
3. A generated try-on result.
4. The wp-admin connection and status screen.
5. A generated men's try-on result.

== Changelog ==

= 0.4.0 =
* Anonymous analytics are now strictly opt-in. No visitor cookie and no analytics or order events are sent unless you enable "Anonymous analytics" (off by default) or your consent banner grants analytics consent. The shopper-initiated try-on is unaffected.
* Added a full external-services, cookie, and consent disclosure.
* Points at the current aisthetix service endpoint by default.
* Housekeeping: refreshed "Tested up to" and the plugin/author links, and included the widget's source for build transparency.

= 0.3.0 =
* Shopper photos and garment images are now compressed in the browser before upload — large photos "just work" instead of being rejected, and uploads are faster.
* The photo picker now accepts any image the browser can read (including HEIC); only genuinely unreadable files are declined, with a clear message.

= 0.2.0 =
* Try-on now routes to an AI provider based on the product's category (e.g. swimwear), improving result quality per garment type.
* Added a consent step before generating an AI try-on of the shopper's photo.

= 0.1.0 =
* Initial foundation: Connect flow, storefront bootstrap + widget, cached status, placements (auto-hook, shortcode, Gutenberg block, Elementor widget), and optimizer exclusions.

== Upgrade Notice ==

= 0.4.0 =
Analytics is now opt-in (off by default). Enable "Anonymous analytics" under WooCommerce -> aisthetix Try-On if you want try-on attribution.

= 0.1.0 =
First release.
