Prerequisites
Before installing the loader, you need:- A custom storefront site in virtual.fit.
- Its public site key and hosted loader URL.
- An exact production or staging origin.
- One synced, enabled product with usable garment images.
- A CSS selector for the main product media wrapper.
1. Allow the storefront origin
In virtual.fit, open Custom JS → Installation. Add each origin that will load the widget or send analytics.| Page URL | Allowed origin |
|---|---|
https://shop.example.com/products/linen-dress | https://shop.example.com |
https://staging.example.com:8443/p/sku-42 | https://staging.example.com:8443 |
2. Sync and enable one product
Use a CSV import or the management API to add a product. Itshandle or product_id must match the value your product URL exposes.
For /products/linen-midi-dress, a typical record uses:
3. Configure product URL detection
For a URL such ashttps://shop.example.com/products/linen-midi-dress:
- Set Resolution Mode to Path template.
- Set Match Products By to Handle.
- Set Path Template to
/products/:handle.
4. Install the loader
Copy the generated snippet from virtual.fit. The basic pattern is:</body>. Use the exact site key and script URL shown in virtual.fit.
window.bitstudio is the stable browser API name retained for integration compatibility. Use virtual.fit in all merchant and shopper-facing copy.Choose the mount target
Pointmount at the main product gallery or media wrapper.
Good targets:
5. Provide full terms markup
If you usefullSelector, add a hidden element whose innerHTML the widget can display:
terms.fullHtml directly. See Styling, labels, and terms.
6. Verify the integration
Open the real product URL and confirm:- The Try On control appears once.
- A disabled or unknown product does not show the control.
- The widget is positioned over the main product media.
- A photo can be uploaded and a try-on completes.
- The generated image appears under Results in virtual.fit.
Your first integration is complete when one enabled product passes the full launch checklist.
Next steps
Configure the loader
Add authentication, product context, terms, and advanced selectors.
Track commerce
Connect add-to-cart, checkout, and purchase outcomes to try-on usage.