Documentation
Add a virtual try-on button to any clothing store — Shopify, WooCommerce, Wix, Squarespace, or a fully custom site. No backend required. Just paste a script tag.
Getting Started
TryyOnYou lets your customers virtually try on clothing using AI — right on your product pages. The widget is a single JavaScript file with zero external dependencies. It takes under 5 minutes to install on any platform.
Create a free account
Get your API key
Install on your platform
Test it
Widget Installation
The widget is installed by pasting three HTML lines into your site. The code sets a few JavaScript globals, then loads the widget script and stylesheet. The widget auto-initializes the moment it loads.
Choose your platform below ↓
Shopify
Open Shopify Admin
Open theme.liquid
theme.liquid.Paste the snippet before </body>
</body> tag and paste the code directly before it.Save
<!-- TryyOnYou Widget — paste before </body> in theme.liquid --> <link rel="stylesheet" href="https://tryyonyou.online/widget/tryon-widget.css"> <script> window.TRYON_API_KEY = "vto_YOUR_API_KEY"; window.TRYON_API_URL = "https://tryyonyou.online/api/generate-tryon"; window.TRYON_WIDGET_URL = "https://tryyonyou.online"; // Optional — customize to match your brand window.TRYON_BUTTON_TEXT = "Try On Virtually"; window.TRYON_PRIMARY_COLOR = "#8B5E3C"; window.TRYON_BUTTON_STYLE = "rounded"; // rounded | pill | square | outline | minimal </script> <script defer src="https://tryyonyou.online/widget/tryon-widget.js"></script>
WooCommerce (WordPress)
Find your product image selector
<img> tag and note its class. Common WooCommerce values: .woocommerce-product-gallery__image img or .wp-post-image.Find your Add to Cart button selector
.single_add_to_cart_button.Paste the code into your theme footer
<!-- TryyOnYou Widget — add to WordPress footer --> <link rel="stylesheet" href="https://tryyonyou.online/widget/tryon-widget.css"> <script> window.TRYON_API_KEY = "vto_YOUR_API_KEY"; window.TRYON_API_URL = "https://tryyonyou.online/api/generate-tryon"; window.TRYON_WIDGET_URL = "https://tryyonyou.online"; // ── Tell the widget where YOUR product image is ─────────────── window.TRYON_CUSTOM_IMAGE_SELECTOR = ".woocommerce-product-gallery__image img"; // ── Tell the widget where to inject the button ──────────────── window.TRYON_POSITION = "custom"; // Must be "custom" window.TRYON_CUSTOM_SELECTOR = ".single_add_to_cart_button"; // Optional branding window.TRYON_BUTTON_TEXT = "Try On Virtually"; window.TRYON_PRIMARY_COLOR = "#7F54B3"; window.TRYON_BUTTON_STYLE = "pill"; </script> <script defer src="https://tryyonyou.online/widget/tryon-widget.js"></script>
TryOn Widget: Product image not found. That means you need to adjust TRYON_CUSTOM_IMAGE_SELECTOR.Wix
Enable Dev Mode
Add a Custom HTML Element
Set your image and button selectors
TRYON_CUSTOM_IMAGE_SELECTOR.Publish and test
<!-- TryyOnYou Widget — Wix Custom Code embed (Body End) --> <link rel="stylesheet" href="https://tryyonyou.online/widget/tryon-widget.css"> <script> window.TRYON_API_KEY = "vto_YOUR_API_KEY"; window.TRYON_API_URL = "https://tryyonyou.online/api/generate-tryon"; window.TRYON_WIDGET_URL = "https://tryyonyou.online"; // Inspect your Wix product page to find these selectors window.TRYON_CUSTOM_IMAGE_SELECTOR = "YOUR_PRODUCT_IMAGE_SELECTOR"; window.TRYON_POSITION = "custom"; window.TRYON_CUSTOM_SELECTOR = "YOUR_ADD_TO_CART_SELECTOR"; window.TRYON_BUTTON_TEXT = "Try On Virtually"; window.TRYON_PRIMARY_COLOR = "#0C6EFD"; window.TRYON_BUTTON_STYLE = "rounded"; </script> <script defer src="https://tryyonyou.online/widget/tryon-widget.js"></script>
TRYON_CUSTOM_IMAGE_SELECTOR andTRYON_CUSTOM_SELECTOR unset. The widget will fall back to finding the largest image on the page and inserting the button after it.Squarespace
.ProductItem__Image class which is used by Squarespace's default product templates — so it works out of the box on most Squarespace stores.Open Code Injection
Paste into the Footer field
Save and preview
If the button doesn't appear (custom templates)
TRYON_CUSTOM_IMAGE_SELECTOR andTRYON_CUSTOM_SELECTOR overrides.<!-- TryyOnYou Widget — paste into Squarespace Footer Code Injection --> <link rel="stylesheet" href="https://tryyonyou.online/widget/tryon-widget.css"> <script> window.TRYON_API_KEY = "vto_YOUR_API_KEY"; window.TRYON_API_URL = "https://tryyonyou.online/api/generate-tryon"; window.TRYON_WIDGET_URL = "https://tryyonyou.online"; // Works out-of-the-box on most Squarespace templates. // Only add these if the button doesn't appear: // window.TRYON_CUSTOM_IMAGE_SELECTOR = ".ProductItem__Image img"; // window.TRYON_POSITION = "custom"; // window.TRYON_CUSTOM_SELECTOR = ".sqs-add-to-cart-button"; window.TRYON_BUTTON_TEXT = "Try On Virtually"; window.TRYON_PRIMARY_COLOR = "#1a1a1a"; window.TRYON_BUTTON_STYLE = "pill"; </script> <script defer src="https://tryyonyou.online/widget/tryon-widget.js"></script>
Custom / Self-built Website
Built your store on custom HTML/CSS/JS, React, Vue, Laravel, Django, or anything else? No problem. The widget is just a script tag — it works on any website. You only need to tell it two things: which element is your product image and which element is your Add to Cart button.
Find your product image CSS selector
<img> tag.Examples you might see:
<img class="product-main-photo" src="..."> → .product-main-photo <img id="productImage" src="..."> → #productImage <div class="gallery"><img ...></div> → .gallery img
Then verify it in the DevTools console:
// Paste this in your browser Console on the product page
document.querySelector('.product-main-photo')
// Must return an <img> element, NOT nullFind your Add to Cart button selector
// Verify it in the Console
document.querySelector('.add-to-cart-btn')
// Must return a button element, NOT nullPaste the snippet before </body>
product.html,product.php,product.jsx), add the snippet just before the closing</body> tag.<!-- TryyOnYou Widget — paste before </body> on your product page --> <link rel="stylesheet" href="https://tryyonyou.online/widget/tryon-widget.css"> <script> // ── Required ────────────────────────────────────────────────── window.TRYON_API_KEY = "vto_YOUR_API_KEY"; window.TRYON_API_URL = "https://tryyonyou.online/api/generate-tryon"; window.TRYON_WIDGET_URL = "https://tryyonyou.online"; // ── Your product image selector (from Step 1) ───────────────── window.TRYON_CUSTOM_IMAGE_SELECTOR = ".product-main-photo"; // ── Your Add to Cart button selector (from Step 2) ──────────── window.TRYON_POSITION = "custom"; // MUST be "custom" window.TRYON_CUSTOM_SELECTOR = ".add-to-cart-btn"; // ── Optional styling ────────────────────────────────────────── window.TRYON_BUTTON_TEXT = "Try On Virtually"; window.TRYON_PRIMARY_COLOR = "#000000"; window.TRYON_BUTTON_STYLE = "rounded"; // rounded|pill|square|outline|minimal </script> <script defer src="https://tryyonyou.online/widget/tryon-widget.js"></script>
TRYON_POSITION = "custom"must be set for TRYON_CUSTOM_SELECTOR to be used. Without it, the widget ignores TRYON_CUSTOM_SELECTOR and falls back to its built-in selector list (which won't know your custom class names).Quick Test (no server needed)
Create a file called test.html and open it directly in your browser — no localhost required:
<!DOCTYPE html>
<html>
<head><title>Widget Test</title></head>
<body>
<h1>Test Product</h1>
<!-- A real product image with the class you'll use -->
<img class="product-main-photo"
src="https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?w=400"
alt="T-Shirt" style="width:300px">
<!-- A fake Add to Cart button -->
<button class="add-to-cart-btn"
style="display:block;margin-top:12px;padding:12px 24px;background:#222;color:white;border:none;border-radius:8px;cursor:pointer">
Add to Cart
</button>
<!-- TryyOnYou Widget -->
<link rel="stylesheet" href="https://tryyonyou.online/widget/tryon-widget.css">
<script>
window.TRYON_API_KEY = "vto_YOUR_REAL_API_KEY";
window.TRYON_API_URL = "https://tryyonyou.online/api/generate-tryon";
window.TRYON_WIDGET_URL = "https://tryyonyou.online";
window.TRYON_CUSTOM_IMAGE_SELECTOR = ".product-main-photo";
window.TRYON_POSITION = "custom";
window.TRYON_CUSTOM_SELECTOR = ".add-to-cart-btn";
</script>
<script defer src="https://tryyonyou.online/widget/tryon-widget.js"></script>
</body>
</html>All Configuration Options
All options are set as window.TRYON_* globals in a <script> block before the widget script tag.
| Variable | Required | Description & Values |
|---|---|---|
| TRYON_API_KEY | required | Your API key from the dashboard. Format: vto_xxxxxxxx |
| TRYON_API_URL | required | Always set to: https://tryyonyou.online/api/generate-tryon |
| TRYON_WIDGET_URL | required | Always set to: https://tryyonyou.online — used to load the CSS file. |
| TRYON_BUTTON_TEXT | optional | Text shown on the trigger button. Default: "Try On Virtually" |
| TRYON_PRIMARY_COLOR | optional | Hex color for the button and modal accents. Default: "#6366f1" |
| TRYON_BUTTON_STYLE | optional | Button shape. Values: rounded (default) | pill | square | outline | minimal |
| TRYON_FONT_FAMILY | optional | Font family for the button. Use "inherit" (default) to match your store, or any Google Font name e.g. "Inter". |
| TRYON_FONT_WEIGHT | optional | Font weight. Values: 400 | 500 | 600 (default) | 700 |
| TRYON_POSITION | optional | Where to inject the Try On button relative to the ATC button. Values: afterCart (default) | beforeCart | custom. Must be "custom" to use TRYON_CUSTOM_SELECTOR. |
| TRYON_CUSTOM_SELECTOR | optional | CSS selector for your Add to Cart button or any element to inject the Try On button next to. Only active when TRYON_POSITION = "custom". |
| TRYON_CUSTOM_IMAGE_SELECTOR | optional | CSS selector for your product image <img> element. When set, this is used first before any built-in selectors. Works on all platforms regardless of TRYON_POSITION. |
API Reference
https://tryyonyou.online/api/generate-tryonGenerates a virtual try-on image by compositing a person photo with a garment image using the IDM-VTON AI model. Returns a base64-encoded PNG.
Request Headers
Request Body
{
"person_image": "<base64 data URL or https:// URL of the person photo>",
"garment_image": "<base64 data URL or https:// URL of the clothing item>",
"page_url": "https://yourstore.com/products/blue-shirt" // optional, for analytics
}| Field | Required | Description |
|---|---|---|
| person_image | required | Photo of the person. Base64 data URL (data:image/jpeg;base64,...) or a public HTTPS image URL. Max 10 MB. JPEG / PNG / WebP. |
| garment_image | required | Photo of the clothing item. Same format as person_image. |
| page_url | optional | The product page URL. Logged in your analytics dashboard. |
Success Response 200
{
"success": true,
"image": "<raw base64 string — no data: prefix>",
"usage": {
"current": 3,
"limit": 50,
"remaining": 47
}
}To display the image: <img src={`data:image/png;base64,${data.image}`}>
Error Responses
{ "success": false, "error": "Both person_image and garment_image are required" }{ "success": false, "error": "API key is required / Invalid API key" }{ "success": false, "error": "Store account is inactive or suspended" }{ "success": false, "error": "Monthly usage limit exceeded. Please upgrade your plan." }{ "success": false, "error": "AI processing failed / Internal server error" }cURL Example
curl -X POST https://tryyonyou.online/api/generate-tryon \
-H "Content-Type: application/json" \
-H "X-API-Key: vto_YOUR_API_KEY" \
-d '{
"person_image": "data:image/jpeg;base64,/9j/4AAQ...",
"garment_image": "https://yourstore.com/images/shirt.jpg",
"page_url": "https://yourstore.com/products/blue-shirt"
}'Authentication
All requests to the API are authenticated with your API key sent in the X-API-Key header.
Getting your API key
- Log in at tryyonyou.online/login
- Go to Dashboard → Installation
- Click the eye icon to reveal your key, then copy it
API key format
Example: vto_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4
Regenerating your key
On the Installation page, click "Regenerate Key". Your old key stops working immediately — update your widget snippet with the new key.
Troubleshooting
Open browser DevTools → Console (F12) on your product page. The widget logs helpful messages to guide you.
Button doesn't appear at all
Console says "Product image not found, retrying..."
Console says "Could not find button container"
Button appears but in the wrong position
"Invalid API key" error in the modal
"Monthly usage limit exceeded" error
The widget loads but the garment image is wrong (wrong product)
Widget works on desktop but not mobile
Still stuck?
Send us your platform name, the URL of your product page, and a screenshot of the browser Console — we'll get your widget working within 24 hours.
Email Support