=== TryOnCloud - AI Virtual TryOn for WooCommerce ===
Contributors: tryon800
Tags: virtual try-on, woocommerce, try before you buy, ai fashion, virtual fitting room
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.5.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add an AI virtual try-on to your WooCommerce product pages. Shoppers upload a photo and see your garment on themselves. Connects to the TryOnCloud service.

== Description ==

TryOnCloud adds an AI virtual try-on (a virtual fitting room) to your WooCommerce product pages. A shopper clicks the Try On button, uploads a photo, and sees how the selected garment looks on their own body — no app and no AR glasses required.

The plugin connects your store to the TryOnCloud service, an external API that generates the try-on image (see the "External Service" section below for details and data handling). Setup takes a few minutes and requires no code.

> Also available as a Shopify app — [TryOnCloud on the Shopify App Store](https://apps.shopify.com/tryoncloud)

= Why use it =

Shoppers often return clothing because a flat product photo doesn't show how an item will look on their own body. Letting them preview the garment on themselves before buying helps them make a more confident purchase decision.

- Adds a Try On button to the product pages you choose (by category or individual product)
- Shoppers upload a photo and receive a generated try-on image
- Fully customizable button — color, text, position, radius, and font
- Per-visitor usage limits (daily, weekly, or monthly)
- API key is stored and used server-side only — never exposed to the browser
- Works on all body types and skin tones

= How the WooCommerce Virtual Try-On Works =

1. A **Try On** button appears on your configured WooCommerce product pages
2. The shopper clicks the button and uploads their photo
3. Your WordPress server securely proxies the image to the TryOnCloud AI (API key stays server-side — never in the browser)
4. The AI generates a photorealistic virtual try-on result in approximately 7 seconds
5. The shopper sees the garment on their own body and can download the result

= Full Feature List =

* AI virtual try-on for WooCommerce — photorealistic results on real shopper photos
* Virtual fitting room for WordPress — responsive modal, mobile-friendly, no app required
* One-click Try On button on any WooCommerce product page
* Works with all clothing types — t-shirts, dresses, hoodies, jackets, activewear, and more
* Fully customizable button — color, text, position, border radius, font size, font weight, font family
* Target specific product categories and/or individual products
* Individual product search with AJAX — works with stores of 1,000+ products
* Usage limits per visitor — daily, weekly, or monthly with server-side enforcement
* API key stored server-side — never exposed to the browser (AJAX proxy architecture)
* Server-side MIME-type validation on uploaded photos
* Nonce-protected AJAX requests — secure by design
* Connection test built into settings page
* Isolated CSS — no conflicts with any WordPress theme
* Full translation support — i18n ready with .po/.mo support

= Documentation and Integration Guides =

* [WooCommerce Virtual Try-On Integration Guide](https://www.tryoncloud.com/integrations/woocommerce)
* [Full Setup Documentation](https://www.tryoncloud.com/docs)
* [How to Reduce Clothing Returns with Virtual Try-On](https://www.tryoncloud.com/blog/reduce-clothing-returns)
* [Try Before You Buy: How AI Virtual Try-On Works](https://www.tryoncloud.com/blog/try-before-you-buy-shopify)
* [Increase WooCommerce Clothing Store Conversions](https://www.tryoncloud.com/blog/increase-shopify-clothing-store-conversions)
* [Pricing Plans — Free tier available](https://www.tryoncloud.com/pricing)

= Also Available for Shopify =

Running a Shopify store instead of WooCommerce? TryOnCloud is available on the Shopify App Store with the same AI virtual try-on technology, drag-and-drop theme block installation, and no code required.

[View TryOnCloud on the Shopify App Store](https://apps.shopify.com/tryoncloud) | [Learn about Shopify virtual try-on integration](https://www.tryoncloud.com/integrations/shopify)

= External Service =

This plugin connects to the **TryOnCloud API** (https://www.tryoncloud.com) to perform AI virtual try-on generation.

**What data is sent:**
- The customer's uploaded photo (sent from your WordPress server to the TryOnCloud API)
- The product image URL (sent from your WordPress server to the TryOnCloud API)

**When data is sent:**
Only when a customer clicks the Try On button and submits their photo. No data is sent passively or during page load.

**Who operates the service:**
TryOnCloud (https://www.tryoncloud.com). Store owners must create an account and agree to TryOnCloud's terms before using this plugin.

- [Terms of Service](https://www.tryoncloud.com/terms)
- [Privacy Policy](https://www.tryoncloud.com/privacy)

= Requirements =

* WooCommerce 5.0 or higher
* PHP 7.4 or higher
* A TryOnCloud account — [create a free account](https://www.tryoncloud.com)
* An API Key from your TryOnCloud dashboard

== Installation ==

**Automatic installation (recommended):**

1. Go to **WordPress Admin > Plugins > Add New**
2. Search for "TryOnCloud virtual try-on"
3. Click **Install Now**, then **Activate**

**Manual installation:**

1. Download the plugin ZIP from [tryoncloud.com](https://www.tryoncloud.com/integrations/woocommerce)
2. Go to **WordPress Admin > Plugins > Add New > Upload Plugin**
3. Upload the ZIP and click **Activate**

**After activation:**

1. Go to **WooCommerce > TryOnCloud** in the admin sidebar
2. Enter your **API URL** (`https://www.tryoncloud.com`) and **API Key** from your TryOnCloud dashboard
3. Click **Test Connection** to verify credentials
4. **Register your store domain** — go to your TryOnCloud dashboard > **Stores** > enter your domain (e.g. `mystore.com`) and click **Add** — this is required before any try-on can run
5. Under **Product Categories**, select which categories show the Try On button, or use **Individual Products** to target specific items
6. Click **Save Settings**
7. Visit a product page to see the Try On button live

Full WooCommerce virtual try-on setup guide: [WooCommerce Virtual Try-On Setup](https://www.tryoncloud.com/integrations/woocommerce)

== Frequently Asked Questions ==

= How do I add a virtual try-on to my WooCommerce store? =

Adding a virtual try-on to WooCommerce takes under 2 minutes:

1. Install and activate this plugin
2. Create a free TryOnCloud account at https://www.tryoncloud.com
3. Copy your API key from Dashboard > API Keys
4. Enter it in **WooCommerce > TryOnCloud > API Configuration**
5. Register your store domain in the TryOnCloud dashboard
6. Select at least one product category to enable the virtual try-on button

The virtual try-on button will appear on your WooCommerce product pages immediately after saving.

Full step-by-step guide: [How to Add Virtual Try-On to WooCommerce](https://www.tryoncloud.com/integrations/woocommerce)

= Does virtual try-on reduce clothing returns? =

Yes. When shoppers can see how a garment looks on their own body before buying, they make more confident purchase decisions. Stores using TryOnCloud report fewer returns because shoppers have realistic expectations about fit and appearance before checkout.

Read more: [How Virtual Try-On Reduces Clothing Returns](https://www.tryoncloud.com/blog/reduce-clothing-returns)

= Is this plugin free? =

The plugin is free to install. It connects to the TryOnCloud API which offers a **free plan with 10 virtual try-ons per month** — no credit card required. Paid plans are available for higher volume stores.

See all plans: [TryOnCloud Pricing](https://www.tryoncloud.com/pricing)

= Is TryOnCloud available for Shopify too? =

Yes. TryOnCloud has a dedicated Shopify app with drag-and-drop theme block installation. The same AI technology, the same quality, installed in under 2 minutes with no code required.

[TryOnCloud on Shopify App Store](https://apps.shopify.com/tryoncloud) | [Shopify Integration Guide](https://www.tryoncloud.com/integrations/shopify)

= Does the virtual fitting room work on mobile? =

Yes. The try-on modal is fully responsive and works on all screen sizes. Shoppers on mobile can upload photos directly from their camera roll or take a new photo.

= What clothing types does the WooCommerce virtual try-on support? =

The AI virtual try-on works with all standard clothing types:
- Tops: t-shirts, blouses, shirts, hoodies, sweaters
- Dresses and skirts
- Jackets, coats, and outerwear
- Activewear and sportswear
- All body types and skin tones supported

= Does it work with all WooCommerce themes? =

Yes. All plugin CSS is scoped under a unique `.aivt-` prefix with `!important` overrides to prevent any theme conflict. It has been tested with Storefront, Flatsome, Astra, OceanWP, Blocksy, and all major WooCommerce themes.

= How do I control which products show the Try On button? =

In WooCommerce > TryOnCloud > Product Categories, select the categories that should display the button. You can also target individual products by name using the product search. Both filters use OR logic — the button shows if either a category or individual product match. If nothing is selected, the button is hidden on all products until you configure at least one filter.

= Is the API key secure? =

Yes. Your API key is stored in the WordPress database and only used server-side inside the AJAX proxy handler. It is never passed to the browser or included in any JavaScript. Customers interact only with your WordPress AJAX endpoint — the TryOnCloud API key is invisible to them.

= What image formats can customers upload? =

JPEG, PNG, and WebP. The MIME type is validated server-side (not just by file extension) before forwarding the image to the API.

= I get an error: domain not registered =

You must register your store domain in the TryOnCloud dashboard before the API will accept requests. Go to **Dashboard > Stores**, enter your domain (e.g. `mystore.com`) and click **Add**. The API validates that all product image URLs come from a registered domain on every request.

= The Try On button is not showing =

1. Check your API URL and Key are saved in **WooCommerce > TryOnCloud**
2. Click **Test Connection** to verify the credentials work
3. Make sure your domain is registered in the TryOnCloud dashboard
4. Make sure at least one Product Category or Individual Product is selected
5. Confirm the product page you are testing matches your configured filter

= Where can I find the documentation? =

Full documentation is available at [https://www.tryoncloud.com/docs](https://www.tryoncloud.com/docs)

== Screenshots ==

1. The Try On button on a WooCommerce product page
2. Customer photo upload modal — step 1
3. AI-generated virtual try-on result displayed to the shopper
4. Plugin settings page — API configuration and connection test
5. Plugin settings page — Button appearance customization with live preview
6. Plugin settings page — Product category and individual product targeting

== Changelog ==

= 1.5.0 =
* Compliance: moved all inline <script> and <style> out of modal.php and settings.php into enqueued asset files (modal.js, admin.js, admin.css) using wp_enqueue_script/style and wp_localize_script.
* Compliance: bundled the HEIC image converter locally instead of loading it from a remote CDN. It now lazy-loads from the plugin only when a HEIC photo is uploaded.
* Compliance: removed load_plugin_textdomain() — WordPress.org loads translations automatically since WP 4.6.
* Docs: clarified the readme description and the external-service disclosure.

= 1.4.1 =
* Security: try-on requests are now signed (HMAC-SHA256) so the service can verify they come from a holder of the API key and reject replays.

= 1.4.0 =
* New: Plugin renamed to "TryOnCloud - AI Virtual TryOn"
* New: Full i18n support — all user-visible strings now translatable
* New: languages/ folder with text domain tryoncloud-ai-virtual-tryon
* New: Domain Path header added for correct .mo file loading
* New: Plugin URI updated to tryoncloud.com/integrations/woocommerce
* Fix: load_plugin_textdomain() now called correctly at plugins_loaded priority 1
* Fix: text domain passed as a literal string in all translation calls (Plugin Check compliant)
* Fix: plugin folder, main file, and text domain all aligned to slug "tryoncloud-ai-virtual-tryon"

= 1.3.0 =
* New: Individual product search with AJAX — find and select specific products by name, works with 1,000+ product stores
* New: Warning notice shown in settings when no products or categories are configured
* New: Button hidden by default on all products until store owner configures at least one filter
* Fix: Product search now uses direct database title LIKE query for reliable results
* Fix: Search results dropdown no longer clipped inside settings card
* Fix: Price display in search results now shows clean formatted price
* Fix: Content filtering API errors now show a clear user-friendly message

= 1.2.6 =
* New: Border radius, padding, font size, font weight, and font family controls for the Try On button
* Fix: Button style changes now apply instantly — no hard refresh required
* Fix: Browser autofill no longer fills API credential fields
* New: Settings link added to the WordPress Plugins list page

= 1.2.0 =
* New: Complete settings UI redesign with card layout and isolated CSS
* New: Button color is fully customizable — no hardcoded colors
* New: CSS custom properties architecture for all button styles

= 1.0.0 =
* Initial release
* Try On button and modal on WooCommerce product pages
* Admin settings page for API configuration
* Customizable button text, position, and color
* Server-side AJAX proxy — API key never sent to browser
* MIME-type validation on customer photo uploads
* Connection test utility in settings

== Upgrade Notice ==

= 1.4.0 =
Plugin renamed and i18n added. No settings changes required — update and activate.

= 1.3.0 =
After updating: go to WooCommerce > TryOnCloud and select at least one product category or individual product to re-enable the Try On button. The button is now hidden by default until configured.
