=== MirrAR Virtual Try On ===
Contributors: mirrarofficial
Donate link: https://mirrar.ai
Tags: virtual try-on, augmented reality, woocommerce, jewellery, eyewear
Requires at least: 6.2
Tested up to: 7.1
Stable tag: 1.0.0
Requires PHP: 7.0
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Add MirrAR virtual try-on to your WooCommerce product pages. Customers try jewellery, eyewear and watches on themselves before they buy.

== Description ==

MirrAR Virtual Try On adds a **Try On** button to your WooCommerce products. Customers press it and see the product on themselves, live, through their camera — necklaces, earrings, rings, bracelets, bangles, wrist watches, eyewear and more.

The plugin is the part that lives on your shop. Your try-ons are prepared in your MirrAR account, and the plugin shows the Try On button on exactly the products that have one.

**What it does**

* **Connects itself.** Approve your shop once from the WooCommerce connector in MirrAR. The plugin then collects its own credentials — there is no key or secret to copy and paste.
* **Follows try-on prep.** When you publish a product's try-on in MirrAR, its Try On button appears on your shop within seconds, and disappears again if you unpublish it. You can still switch any product on or off by hand, and your choice always wins.
* **Matches products by SKU, automatically** — the product's own SKU, or for a variable product with no SKU of its own, its variations' SKUs. The same rule MirrAR uses when it imports your products, so there is nothing to set up.
* **Button styling.** Colours, text, icon, borders, padding and shadow, with a live preview.
* **Stays in step with your MirrAR account.** If you disconnect the shop in MirrAR, move it to another MirrAR account, or revoke MirrAR's key in WooCommerce, the plugin notices and switches try-on off (or over) by itself.

Requires WooCommerce and a MirrAR account.

== Installation ==

1. In **Plugins → Add New**, search for **MirrAR Virtual Try On**, then **Install Now** and **Activate**. WooCommerce must be active. (The MirrAR connector also gives you a one-click install link for your shop.)
2. In your MirrAR account, open the **WooCommerce VTO Connector**, enter your shop address and press **Approve**. WooCommerce asks you to approve read access for "MirrAR Virtual Try-On" — approve it.
3. That is all. The plugin connects itself within a few minutes — or straight away if you press **Check now** in **MirrAR Virtual Try On → General settings**, which shows "Connected to MirrAR" when it is done.
4. In MirrAR try-on prep, choose the products that need try-on and publish them. Their Try On buttons appear on your shop by themselves.

The order of steps 1 and 2 does not matter: if you install the plugin first, it waits for the approval and connects as soon as it arrives.

== Frequently Asked Questions ==

= What do I need before I start? =

A WooCommerce shop (WooCommerce must be active — WordPress will not activate the plugin without it) and a MirrAR account with the WooCommerce VTO Connector. Your products need SKUs, because that is how MirrAR and your shop match products.

= How do I know the plugin is connected? =

Look at the status line at the top of **MirrAR Virtual Try On → General settings**:

* **Connected to MirrAR** — with how many products are ready for try-on.
* **Not connected to MirrAR yet** — with the reason, for example that it is waiting for the shop to be approved, or that the shop was disconnected in MirrAR. Press **Check now** to try again straight away.

= How long after I publish a try-on does the button appear? =

Usually within seconds: MirrAR tells your shop that something changed. If that message cannot get through — some hosts block it — the plugin also checks every five minutes. On a shop with no visitors it can take longer, because WordPress only runs its scheduled checks when somebody visits.

= Why is the Try On button not showing on a product? =

Check, in order:

1. **MirrAR Virtual Try On → General settings** says "Connected to MirrAR".
2. "Show the Try On button on product pages" (and/or "…on product lists") is switched on in General settings.
3. The product's try-on is published in MirrAR try-on prep.
4. The product has a SKU (or, for a variable product, its variations do), and it is the same SKU as the product in MirrAR. The product's **MirrAR Virtual Try On** tab shows which SKU it is matched by.
5. On the product's **MirrAR Virtual Try On** tab, **Enable MirrAR Virtual Try On** is ticked. If you unticked it yourself earlier, MirrAR will not switch it back on — tick it again.

= Can I show or hide the button on one product by hand? =

Yes. Edit the product, open the **MirrAR Virtual Try On** tab in Product data, and tick or untick **Enable MirrAR Virtual Try On**. A change you make there always wins over MirrAR: a product you switch off stays off, and one you switch on stays on.

= Does it work with variable products? =

Yes, one Try On button per product. It is matched by the product's own SKU — or, if the product has no SKU of its own, by its variations' SKUs, the same way MirrAR names such a product when it imports it. Nothing to set up.

= How do I change how the button looks? =

**MirrAR Virtual Try On → General settings** → **Custom Button Style**. The preview on the right shows the result as you change it.

= How do I disconnect the shop? =

Press **Disconnect** in the WooCommerce VTO Connector in MirrAR. Within a few minutes the plugin switches try-on off on your shop. Revoking the "MirrAR Virtual Try-On" key in **WooCommerce → Settings → Advanced → REST API** does the same.

= Can I move the shop to another MirrAR account? =

Yes. Disconnect it from the first account, then approve it from the second. The plugin switches over by itself and removes the first account's key from your shop. While the first account is still connected, the second one cannot connect the shop.

= What happens when I deactivate or delete the plugin? =

Deactivating keeps all your settings, and MirrAR is told the plugin is inactive; activate it again and it carries on. Deleting the plugin removes everything it stored — its settings and the Try On switches on your products — but keeps the "MirrAR Virtual Try-On" key in WooCommerce, which belongs to your MirrAR connection rather than to the plugin. Reinstall it and it connects itself again.

= Does my shop need a particular permalink setting or .htaccess change? =

No. The try-on opens in an overlay on the product page and needs no rewrite rules.

= Why can't I upload an SVG logo? =

SVG files can carry scripts, so the plugin does not enable SVG uploads — WordPress blocks them by default for the same reason. Use PNG, JPG, GIF or WebP.

== External services ==

This plugin relies on the MirrAR service to show virtual try-on. It connects to it in the following ways.

**MirrAR API — app.mirrar.ai**

Used to connect the shop to your MirrAR account and to keep the Try On buttons up to date. Requests are made from your server, only while the shop is being connected or is connected:

* When the shop is connected: your site address, the last seven characters of the "MirrAR Virtual Try-On" WooCommerce key and a signature made with that key's secret (the secret itself is never sent), plus the plugin, WooCommerce and WordPress version numbers.
* To sign in: the store's Client ID and Client Secret, exchanged for an access token.
* Every five minutes, and when MirrAR signals a change: your site address, to check that the shop is still connected and to read which product SKUs have a try-on ready.
* When the plugin is activated, deactivated or deleted, or MirrAR's key is revoked: your site address and which of these happened.

No customer or order data is sent.

MirrAR can also send your shop a notice at `/wp-json/mirrar/v1/tryon-sync` when a try-on changes. It carries no data; the plugin answers it by reading the list above with its own credentials.

**MirrAR Try On button — app.mirrar.ai and your MirrAR store address**

On product pages that show the button, the script `https://app.mirrar.ai/XR/vto/mirrar-tryon-button.min.js` is loaded in the visitor's browser. When a visitor presses Try On, the try-on opens from your MirrAR store address with the product's SKU, and uses the visitor's camera for the live try-on.

MirrAR [Terms of Service](https://mirrar.ai/terms/) and [Privacy Policy](https://mirrar.ai/privacy/).

== Changelog ==

= 1.0.0 =
* Connects itself after you approve the shop in MirrAR — no keys to copy. The Store Connection tab is replaced by a status line in General settings.
* Try On buttons follow MirrAR try-on prep automatically; a manual choice on a product always wins.
* New **MirrAR Virtual Try On** tab in Product data, with **Enable MirrAR Virtual Try On** and the SKU the product is matched by.
* Products are matched by SKU automatically, including variable products with no SKU of their own; the separate "MirrAR SKU" field is gone.
* Switches try-on off, or over to the new account, when the shop is disconnected in MirrAR, moved to another account, or MirrAR's key is revoked.
* Tells MirrAR when the plugin is activated, deactivated or deleted.
* "Show product list panel" moved to General settings.
* Deleting the plugin now removes all of its data.
* SVG uploads are no longer enabled.
* Security and coding-standards fixes from Plugin Check.
* Tested up to WordPress 7.1; requires WordPress 6.2 or later.

== Upgrade Notice ==

= 1.0.0 =
Connects itself — no API keys needed any more. After updating, approve your shop from the WooCommerce connector in MirrAR if it is not connected yet.
