=== Etryon Virtual Try-On ===

Contributors: kevin52718
Tags: woocommerce, virtual-try-on, ai-try-on, fashion, e-commerce
Requires at least: 6.2
Tested up to: 7.1.3
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 1.0.35
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add AI virtual try-on to WooCommerce product pages. Shoppers preview selected products, get style tips, and add to cart.

== Description ==

Add an AI virtual try-on experience to your WooCommerce product pages. Shoppers can upload or take a full-body photo, preview the product they are viewing, get an AI Shopping Guide after the result, and continue to cart without leaving the try-on flow.

ETRYON is built for fashion and apparel stores that want shoppers to visualize a product on themselves before deciding what to buy. The generated image is a visual preview; it does not measure the shopper or guarantee fit, sizing, color, or fabric accuracy.

= Why stores use virtual try-on =

* **Product-page try-on** — Shoppers preview the product they are browsing on their uploaded or captured photo.
* **A guided path to cart** — Review results and history, choose available product options, use a configured offer, and add the item to cart from the modal.
* **AI Shopping Guide** — When enabled, show a short style verdict, occasion suggestions, or a styling tip after the try-on.
* **Controls for your catalog and storefront** — Choose eligible products or categories, configure backgrounds and generation options, customize storefront text and styles, set daily limits, and manage image retention.
* **Usage insights** — Review try-on activity and supported funnel events in the admin dashboard.

Virtual try-on is a visual aid for exploring style. It is not a sizing tool or a substitute for product measurements, your sizing policy, or customer support.

= How it works =

On a supported WooCommerce product page, shoppers open the try-on modal and upload or capture a photo (camera availability depends on the device and browser). ETRYON generates a visual preview using the current product image. For variable products, it uses the selected variation’s image when one is available. Shoppers can review the result, get the AI Shopping Guide when enabled, view previous try-ons, and add the product to cart. Merchants can optionally configure an offer prompt and coupon for the post-try-on flow.

**Live demo:** Try it on our [WooCommerce demo store](https://demo.etryon.ai/)—no plugin install required.

= Key features =

* AI-generated visual try-on on WooCommerce single product pages
* Photo upload or camera capture, plus recent uploads for returning shoppers
* Product-aware previews, including the selected variation image when available
* AI Shopping Guide with style and occasion cues; language can match the storefront
* Try-on history, larger result preview, product options, and add to cart in the modal
* Optional post-try-on offer prompt with merchant-configured coupon and discount text
* Merchant controls for product/category availability, daily limits, aspect ratio, backgrounds, beauty settings, storefront text/styles, and image retention
* Admin dashboard for connection status, usage, generation jobs, and supported funnel events
* API key is used server-side; site-domain validation helps protect API access

= Requirements =

* **WooCommerce** (required)
* **WordPress** 6.2+ · **PHP** 7.4+
* **Etryon account & API key** — Image generation is processed by Etryon’s service; usage follows Etryon plans and policies (https://etryon.ai/).

Outcomes depend on your store, products, and shopper photos.

== Installation ==

1. Install and activate WooCommerce.
2. Install this plugin (ZIP upload or copy the folder into `wp-content/plugins/`) and activate it.
3. Run the setup wizard: register at https://app.etryon.ai, add your API key, and optionally verify your site domain.
4. Adjust settings under the **Etryon Try-On** admin menu.

== Frequently Asked Questions ==

= Is there a live demo? =

Yes. Browse products and use Virtual Try-On on https://demo.etryon.ai/ (no WordPress install required).

= How can this help my store? =

Virtual try-on gives shoppers an AI-generated visual preview of the product they are viewing. The modal also supports try-on history and adding the item to cart; merchants can enable the AI Shopping Guide and configure a post-try-on offer. Results depend on the product image and shopper photo. The preview does not determine fit or size and should be used alongside your product measurements and sizing information.

= Do I need an Etryon account? =

Yes. The plugin authenticates to Etryon with your API key. Create an account at https://app.etryon.ai .

= Can I change labels and button text? =

Yes. Use **Etryon Try-On → Text & Styles**.

= Where are generated images stored? =

High-resolution outputs are stored on your site according to **Images & Storage**. Etryon may keep a limited preview for operational records.

= What happens to plugin data when I uninstall? =

By default, uninstall **does not** wipe the plugin’s settings or custom tables, so you do not lose history or references to stored files after an accidental uninstall. To delete all plugin data on uninstall, set `ETRYON_TRYON_PURGE_DATA_ON_UNINSTALL` to `true` in `wp-config.php` before deleting the plugin from **Plugins**.

== Privacy ==

= What data is sent to Etryon? =

This plugin uses a third-party service (Etryon) to generate try-on images.

When a shopper uses Virtual Try-On, the plugin sends the following data to Etryon’s API:

- a URL to the shopper photo (uploaded to Etryon storage via the plugin; the API receives a signed URL so Etryon can fetch the image for generation)
- a URL to the garment or product image used for the try-on (the selected variation’s image when applicable)
- generation settings from the plugin (for example aspect ratio, background option, and beauty when enabled)
- your site domain (HTTP header `X-Site-Domain` for domain validation)

Product and variation IDs are stored in your WordPress database for history, daily limits, and cart-related flows; they are not included in the JSON body sent to Etryon’s task API in this plugin version.

The plugin does not expose your API key in the storefront UI; it is used server-side to authenticate API requests.

= Data storage and retention =

- Shopper uploads are stored on Etryon infrastructure (Supabase) for up to 14 days by default, then removed automatically. Large uploads are resized client-side and server-side (max long edge 1024px) before storage to improve reliability.
- Generated try-on images may be stored on your WordPress site according to **Etryon Try-On → Images & Storage** (retention can be configured).
- Etryon processes uploaded content to provide the try-on result. Etryon’s retention and processing details are described in their policies:
  - Privacy Policy: https://etryon.ai/privacy
  - Terms of Service: https://etryon.ai/terms

= Uninstall and local data =

By default, uninstalling the plugin **does not** delete its options or custom database tables. This avoids accidental loss of try-on history and stored media references if the plugin is removed by mistake or temporarily for troubleshooting. To remove all plugin-specific options and custom tables when you uninstall, define `ETRYON_TRYON_PURGE_DATA_ON_UNINSTALL` as `true` in `wp-config.php` **before** you delete the plugin. See **Etryon Try-On → Images & Storage** in wp-admin for the same guidance.

== Screenshots ==

1. Virtual try-on button on a WooCommerce single product page.
2. Step 1 of the try-on modal: upload a photo or use a recent upload.
3. Step 2: review the uploaded photo and start generation.
4. Try-on result with variant options, add to cart, and image preview.
5. Admin dashboard: connection status, usage, and recent generation jobs.
6. Generation settings: product availability and daily try-on limits.
7. Output controls: aspect ratio and selectable AI background scenes.
8. Text & Styles: customize storefront button and modal labels with live preview.
9. Images & Storage: upload limits, retention, and uninstall guidance.

== Changelog ==

= 1.0.35 =
* Fixed the post-try-on offer card so its configured headline remains visible when no style verdict is available.
* Verified compatibility with WordPress 7.1.3 and WooCommerce 11.2.1.

= 1.0.34 =
* Added product-aware try-on generation using the current WooCommerce product and selected variation.
* Improved automatic framing and visual emphasis for different types of wearable products.

= 1.0.33 =
* Added AI Shopping Guide language auto-matching and support for more storefront languages.
* Refined the post-try-on conversion experience and marketing settings layout.
* Improved storefront modal copy and display consistency.

= 1.0.32 =
* Added AI Shopping Guide language auto-matching and support for more storefront languages.
* Refined the post-try-on conversion experience and marketing settings layout.
* Improved storefront modal copy and display consistency.

= 1.0.31 =
* Added new background scene options for different shopping moments.
* Improved background scene selection on desktop and mobile.
* Improved storefront button and modal display compatibility.

= 1.0.30 =
* Fixed the try-on result modal width on desktop screens.
* Improved storefront display compatibility with more WooCommerce themes.

= 1.0.29 =
* Improved storefront compatibility with more WooCommerce themes.
* Improved button, icon, notice, cart, and product price display in the try-on modal.

= 1.0.28 =
* Refined the try-on intro animation for a smoother first impression.
* Improved intro text timing, readability, and spacing in the try-on modal.
* Updated the Text & Styles preview to better match the storefront modal.

= 1.0.27 =
* Improved storefront styling for more themes and color settings.
* Improved product price display in try-on cards and history previews.
* Improved try-on buttons, notices, and large image preview behavior.

= 1.0.26 =
* Improved the upload step with clearer primary and recent-upload buttons.
* Matched the storefront button styles more closely between Shopify and WordPress.

= 1.0.25 =
* Improved the try-on result page with clearer product options and add-to-cart behavior.
* Added a larger result image preview with product details.
* Improved dashboard try-on statistics so they match real generation tasks.
* Simplified product price display in history previews.

= 1.0.24 =
* Added a post-try-on offer prompt so shoppers can use a coupon after seeing their result.
* Added Marketing settings for the offer text, coupon code, discount value, and display delay.
* Improved offer tracking for add-to-cart and cart visits.

= 1.0.23 =
* Added background settings for specific product categories and individual products.
* Made background rule lists easier to manage for stores with many products.
* Improved saving reliability for generation settings.

= 1.0.22 =
* Added storefront conversion funnel metrics and business performance dashboard refinements.
* Improved dashboard card alignment and upload-success tracking for recent photos.

= 1.0.21 =
* Refined admin dashboard layout and storefront analytics reporting.

= 1.0.20 =
* Strengthened image upload validation to reject files that are not genuine supported images.
* Restricted remote garment downloads to public HTTP URLs to protect private network resources.
* Improved reliability of product image preparation and upload handling.
* Reduced duplicate API upload code without changing the storefront workflow.

= 1.0.19 =
* Try-on button shows a clearer two-step wait state (image processing, then preparing try-on) with a loading indicator.
* Smoother transition when the button becomes ready to generate.
* Refined ready-state button styling.

= 1.0.18 =
* Significantly faster try-on generation—shoppers see results sooner with less waiting.

= 1.0.16 =
* Fixed Upgrade plan and Buy try-ons links on the admin dashboard.
* Improved visibility of membership action buttons on the dashboard.

= 1.0.15 =
* Fixed an issue that could prevent saving the API key during setup.
* Improved domain binding in the admin dashboard.
* Clearer error messages when domain binding fails.

= 1.0.14 =
* Longer create-task API timeout for OpenAI synchronous generation (reduces false "Something went wrong" errors).
* Background prefetch failures no longer show an error banner before the shopper taps Try it on.
* Idempotent retry reuses the same client request id when the server already finished generating.

= 1.0.13 =
* Product garment images are uploaded to Etryon storage from the WordPress server before generation, avoiding host WAF/captcha blocks when the API fetches wp-content URLs.

= 1.0.12 =
* Improved try-on generation speed and responsiveness on product pages.

= 1.0.11 =
* Improved try-on generation speed and responsiveness on product pages.

= 1.0.10 =
* Fix photo upload to Etryon API using JSON base64 (resolves "Invalid JSON body" on some hosts).

= 1.0.9 =
* Shopper uploads are stored on Etryon cloud storage instead of the WordPress media library.
* Upload and camera photos are resized before upload (max long edge 1024px) for faster, more reliable try-on generation.
* Recent uploads are loaded from Etryon storage (default 14-day retention).
* Updated privacy documentation for cloud upload storage.
* Fixed plugin directory short description length for WordPress.org.

= 1.0.8 =
* Declared compatibility with WordPress 7.0.
* Extended try-on generation polling for slower AI jobs (up to about 7.5 minutes).
* Admin and storage settings refinements.

= 1.0.7 =
* Clearer uninstall guidance on the Images & Storage settings page.
* Quick link from plugin admin screens to leave a review on WordPress.org.

= 1.0.6 =
* Improved reliability when saving generation settings (background options).
* Refinements to the generation settings screen in wp-admin.
* General stability and maintenance updates.

= 1.0.5 =
* Improved theme style capture for Text & Styles previews.
* Better storefront behavior when JavaScript is disabled in the browser.

= 1.0.4 =
* Maintenance update (installation paths and media storage locations).

= 1.0.3 =
* Storefront try-on modal improvements and settings cleanup on upgrade.

= 1.0.2 =
* Improved try-on modal styling compatibility with themes.
* Translation and text-domain updates for language packs.

= 1.0.1 =
* Improved how custom storefront styles are applied to the try-on modal.

= 1.0.0 =
* Initial release.
* Setup wizard, dashboard, generation and product availability, text & styles, images and storage.
* Try-on modal with history and add to cart; background task polling and scheduled cleanup.
