Virtual try-on for WooCommerce: a setup guide for clothing stores

OnFitt Team
Virtual try-on for WooCommerce: a setup guide for clothing stores

You can add virtual try-on to a WooCommerce store in about the time it takes to make a coffee: paste one script tag into your site footer, approve your domain, and a "Try it on" button shows up on your product pages. No PHP, no theme rebuild, no changes to your checkout.

Here's the full setup, plus the checks to run before shoppers see it.

What virtual try-on adds to a WooCommerce product page

A virtual fitting room lets a shopper upload a photo of themselves and see the garment on their own body before they buy. On a WooCommerce store it appears as a button next to your product images. The shopper taps it, adds a photo, and gets a picture of themselves wearing that piece.

It answers the question a size chart can't: "How will this look on me?" If you want the longer explanation of how it works, we covered it in what a virtual fitting room is.

Want to see it on your own products before reading further? You can start a free 14 day trial with 100 try-ons and no card.

What you need before you start

  • A WooCommerce store with product pages that show at least one product photo.
  • Admin access to WordPress, so you can add a plugin or edit your theme.
  • An OnFitt account, which gives you an API key in your dashboard.
  • Your store's domain, for example yourstore.com. You add it to your allowed domains list so your key only works on your site.

OnFitt doesn't need access to your products, orders or customer data in WooCommerce. It reads the product photo from the page the shopper is looking at.

Set up virtual try-on for WooCommerce in four steps

1. Copy your script tag

After you sign up, open your OnFitt dashboard and copy your API key. Your script tag looks like this, with your key in place of YOUR_API_KEY:

<script
  src="https://www.getonfitt.com/api/sdk"
  data-api-key="YOUR_API_KEY"
  async>
</script>

2. Add your store domain to the allowed list

In the dashboard, add your store's domain to your allowed domains. This step matters: your key rejects every request from a site that isn't on the list, so the button won't work for shoppers until your domain is there. If you use both yourstore.com and www.yourstore.com, add both, or use a wildcard like *.yourstore.com.

3. Paste the script into your site footer

There are two ways to do this. Pick the one you're comfortable with.

Option A: a header and footer plugin (no code). Install WPCode, the free plugin that used to be called Insert Headers and Footers. Open its header and footer screen, paste the script tag into the footer box and save. This is the route we recommend for most stores, because a theme update can't wipe it out.

Option B: your theme's footer.php. In WordPress, go to Appearance, then Theme File Editor, open footer.php and paste the script just before the closing body tag. Use a child theme if you can. Edits to a parent theme are lost the next time that theme updates, and the button quietly disappears.

4. Open a product page and test it

Open any product page on your live store. The try-on button should sit near your product images. Tap it, upload a photo and check the result shows the right item.

A cream knit sweater product photo, the kind of image virtual try-on for WooCommerce reads from your product page

Checks to run before shoppers see it

  • Try a simple product and a variable product. OnFitt reads the images on the page, so it works with both. On a variable product, pick a color and make sure the try-on uses the photo you expect.
  • Test on your phone. Make sure the button sits clearly near your images and doesn't clash with a sticky add to cart bar.
  • Check your caching and speed plugins. Plugins that combine or delay JavaScript can hold the script back. If the button doesn't appear, clear your cache first, then exclude the OnFitt script from any "delay JavaScript" setting.
  • Look at an unusual product layout. If your theme uses a custom gallery and the button doesn't show, the integration docs explain how to point OnFitt at your gallery with one extra attribute.
  • Match the button to your brand. In the dashboard you can change the button label, colors and corner radius so it looks like part of your store rather than a bolted on widget.

If you'd like to see the finished experience from the shopper's side first, our demo store shows the button on real product pages.

Ready to try this on your own catalog? Create your OnFitt account and you can have it running on your product pages today.

What to expect once it's live

Virtual try-on helps most where doubt is about look and fit: a shopper can't picture the color against their skin, or how a cut will sit on their frame. That's the doubt that leads to "didn't suit me" returns and to shoppers ordering two sizes and sending one back.

It won't fix every return. A seam that splits, a fabric that feels cheaper than the photos suggest, or a parcel that arrives too late for the event are quality and delivery problems, and no fitting room solves those. For the full picture of what you can and can't prevent, our guide to reducing returns in your online clothing store covers the other fixes alongside try-on.

To judge it, note your return reasons and product page conversion for a few weeks before you install, then compare the same products a month later. The products shoppers try on most show you which pieces cause the most hesitation.

Running a Shopify store too?

On Shopify the setup is different: you install OnFitt from the Shopify App Store and add the button in the theme editor. Our Shopify setup guide walks through it, and the WooCommerce page has the short version of everything above.

The best way to know whether virtual try-on works for your WooCommerce store is to put it in front of your own shoppers. Start your free trial, paste the script, and see how they use it this week.

FAQ

Do I need to know PHP to add virtual try-on to WooCommerce?

No. With a header and footer plugin like WPCode, you paste one script tag into a box and save.

Does virtual try-on work with every WordPress theme?

It works independently of your theme, page builder and WooCommerce template, because it runs as a small script on the page. If a custom gallery hides the button, one extra attribute in the script tag tells it where your product images are.

Will it slow down my product pages?

The script loads with the async attribute, so it doesn't block your page from rendering. The try-on itself only runs when a shopper taps the button.

Will it conflict with my other WooCommerce plugins?

It doesn't touch your cart, checkout or product data, so it sits alongside other plugins without changing how they work. Caching plugins that delay JavaScript are the one thing to check, as described above.

How much does virtual try-on for WooCommerce cost?

You can start with a free 14 day trial that includes 100 try-ons and needs no card. After that, paid plans start at $39 a month for 200 try-ons. Check the OnFitt homepage for current plans.

Share

Have questions about virtual try-on for your store?

Contact us