Linux 软件免费装
Banner图

LessLens – Glasses Virtual Try-On for WooCommerce

开发者 lesslens
更新时间 2026年11月27日 21:24
PHP版本: 7.4 及以上
WordPress版本: 7.2
版权: GPLv2 or later
版权网址: 版权信息

标签

woocommerce augmented reality glasses virtual try-on eyewear

下载

1.0.3 1.0.0 1.0.1 1.0.2

详情介绍:

LessLens puts a "Try on virtually" button on the product pages of your glasses and sunglasses, under Add to cart or under the title and price. Shoppers try your frames on their own face right on the product page, in the browser on computers and phones, with nothing to install. What your store gets A LessLens store key is required This plugin connects your store to the LessLens virtual try-on service. The try-on, the 3D models of your frames and your store key come from LessLens with a pilot or a plan: see LessLens for WooCommerce and plans and pricing. Until a store key is saved (it starts with pk_), the plugin adds nothing to your shoppers' pages and nothing is loaded from LessLens for them. You, as the store's admin, can already see the try-on with a LessLens demo frame on your own product pages (see the FAQ).

安装:

  1. Install and activate the plugin. WooCommerce must be active.
  2. Go to WooCommerce → Settings → LessLens Try-On, paste your store key (it starts with pk_) and save. A value that isn't a store key is saved with a warning, and product pages stay as they are until the key is right.
  3. Open a product whose SKU is one of your frames in LessLens: the button is under Add to cart (or under the title and price, if you choose that under "Button position").
No store key yet? Click "See the try-on on your store" in the notice or on the settings tab: one of your product pages opens with a LessLens demo frame, visible only to you. "Request a pilot" opens LessLens's request form. To check the try-on on your live store before shoppers see it, turn on "Test mode" in the same settings before you save the key (see the FAQ). The key works only on the domains LessLens has on file for your store, so tell us every domain the store uses (for example with and without www, or a staging site). The store must be on HTTPS: the service accepts http:// only on localhost, for testing. Used the LessLens code snippet before the plugin? Remove the snippet first (see the FAQ).

屏幕截图:

  • The "Try on virtually" button under Add to cart, on a frame you have in 3D.
  • A classic theme (Storefront): the button follows the colour the shopper picks.
  • On a phone, the try-on opens full screen after a tap.
  • The settings tab: WooCommerce → Settings → LessLens Try-On.

升级注意事项:

1.0.3 See the try-on on your own product pages with a demo frame before you have a key, and which products have a 3D model, in a new Try-on column. Shoppers' pages stay as they are. 1.0.2 A new name and new help answers. Your product pages and settings stay as they are. 1.0.1 Adds a button position under the title and price, a test mode, and a 3D model per colour for colours that share the product's SKU. Fixes the try-on in galleries that fade between photos.

常见问题:

I don't have a store key. What happens?

Your shoppers see nothing: without a key the plugin adds nothing to their pages and nothing is loaded from LessLens for them. You can see the try-on yourself with a demo frame (see the next answer). You get a key from LessLens with a pilot or a plan, together with the 3D models of your frames. See LessLens for WooCommerce.

Can I see the try-on before I get a key?

Yes. After you activate the plugin, a notice (on the Plugins screen, the Dashboard and WooCommerce → Settings) and the plugin's settings tab have a "See the try-on on your store" button. It opens one of your product pages with a LessLens demo frame, in your theme and your product gallery, and you can try the frame on with your camera or a photo. To see it on another product, open that product's page with ?lldemo=1 at the end of its address while logged in. Only people who manage the store see the demo; shoppers don't, even with ?lldemo=1 in the address or behind a page cache. With a store key it works too: it shows the demo frame instead of your own frames on that page, in your browser only. The demo frame is the same for every store; your own frames come with a pilot or a plan. The notice can be closed, and it goes away by itself once a store key is saved.

What does the Try-on column show?

Once a store key is saved, Products → All Products gets a Try-on column, next to SKU. For each product it shows whether its product page has a 3D model to show: "3D ready" (the button shows), "No 3D model yet" or "No SKU" (no button). For a product with colours it shows how many of the colours shoppers can pick have a 3D model, for example "2 of 4 colours". It uses the same rules as the product page, including colours without a SKU of their own. "Off for this product" means the lesslens_tryon_show_button filter on your site keeps the button off it. Test mode doesn't change the column: it decides who sees the button, not which products have it. "Request a 3D model" next to a product without one opens LessLens's request form with the product's name, SKU and link filled in. To ask for several at once, tick them and choose "Request 3D models (LessLens)" from the bulk actions. If the column shows "—", LessLens didn't answer just then, or your key doesn't work on this domain (the settings tab says which), or the product has more than 50 colours or the page lists too many products to check at once (hover over it to see why).

The button doesn't show. Why?

Check these, in this order:

  1. No store key. WooCommerce → Settings → LessLens Try-On needs your store key (it starts with pk_). A value that isn't a store key is saved with a warning, and product pages stay as they are.
  2. Test mode is on. Then only a browser tab opened with ?lltest=1 shows the button (see "Can I check the try-on before shoppers see it?"). If your caching plugin keeps pages for a long time, clear its cache after switching test mode on or off.
  3. The product's frame isn't in your LessLens catalogue. The button shows only on products whose SKU matches a frame you have in 3D (see "Which products show the button?"). Products without a SKU show no button.
  4. The domain isn't on file, or the page isn't on HTTPS. The key works only on the domains LessLens has on file for your store, for example with and without www, and only on https:// pages. Tell us any domain that is missing.
  5. A JavaScript optimiser combines, delays or defers the LessLens script. See "Do I need to change my caching or JavaScript optimisation plugin?".
  6. The button has no place on the page. If your product page has no Add to cart form, for example a custom template or a page-builder layout, turn off the automatic placement and use the [lesslens_tryon] shortcode (see "Does it work with block themes?").
  7. The LessLens code snippet is still active. Then the plugin adds nothing to product pages, and a notice in wp-admin reminds you to remove the snippet.
  8. The lesslens_tryon_show_button filter on your site returns false for that product.
Still no button? Ask in this plugin's support forum or write to info@lesslens.com with the product's link.

Who makes the 3D models of my frames?

LessLens. Tell us which frames to start with: we make their 3D models and set each one up under your product's SKU (or a colour's), so nothing changes in your catalogue. How many new 3D models your plan includes: see plans and pricing.

Which products show the button?

Products whose SKU matches a frame in your LessLens catalogue. The plugin turns the SKU into the frame's name: lower case, with anything other than letters, digits, ".", "_" and "-" replaced by "-" (SKU "AB 1234/Gold" becomes ab-1234-gold). LessLens sets up your frames under these names, so you don't change your SKUs. Products without a SKU, and products whose frame isn't in 3D yet, show no button and stay exactly as they are. The LessLens script itself loads on every product page with a SKU and on every variable product, and asks the service about the page's frames (see "External services"); that is how it finds out which of them have a button.

Can I show the button on some products only?

Yes, with the lesslens_tryon_show_button filter. It gets true and the product; return false and that product page gets no button, and nothing is loaded from LessLens on it. The filter also runs in Products → All Products, for the Try-on column, so base it on the product rather than on the page being shown. For example, only products in the "Sunglasses" category (slug sunglasses), in your child theme's functions.php or a code-snippets plugin: add_filter( 'lesslens_tryon_show_button', function ( $show, $product ) { return $show && has_term( 'sunglasses', 'product_cat', $product->get_id() ); }, 10, 2 );

What about frames in several colours?

Each colour has its own 3D model, named by the variation's SKU. When a shopper picks a colour, the button switches to it. If the try-on is open at that moment and the new colour has another 3D model, it closes (and its camera stops), and the shopper opens it again on the new colour with the button. A colour without a 3D model shows no button. When the page opens on a preselected colour (the product's default colour, or one in the link), the button starts on that colour; otherwise it shows the frame of the product's own SKU, if there is one, until a colour is picked.

My colours have no SKU of their own, or share the product's SKU. What then?

Such a colour is named by the product's SKU and the colour: the colour's attribute values (for an attribute set up under Products → Attributes, the value's slug), in the alphabetical order of the attributes, joined with "-", made into a frame name as the SKU is. Product SKU "AB-1234" in the colour Gold becomes ab-1234-gold; with a second attribute, such as the size Large, ab-1234-gold-large. LessLens sets up a colour's 3D model under that name. If your catalogue has no model under that name, the button shows the product's own frame instead, so a store with one 3D model for all colours of a product keeps its button, as before, on every colour.

Can the button go under the title and price?

Yes. In WooCommerce → Settings → LessLens Try-On, set "Button position" to "Under the title and price". In classic themes the button then goes into WooCommerce's product summary, right after the price (before the short description). In block themes it goes right after the Product Price block of the Single Product template. If your product page has neither, for example a page-builder layout, the button stays under Add to cart. For any other place, use the [lesslens_tryon] shortcode (see the next answer).

Does it work on phones?

Yes. On phones the try-on runs in the browser, with nothing to install: a tap on the button opens it full screen. If the camera isn't available, shoppers can try frames on a photo instead; the photo stays in the browser. On a computer, the try-on opens in place of the product photo.

Can I test it on a staging site first?

Yes. Tell us the staging site's domain and we add it to your store key: the key works only on the domains LessLens has on file for your store. The staging site must be on https://; plain http:// works only on localhost and 127.0.0.1. You can also check the try-on on your live store before shoppers see it, with test mode (see the next answer).

Can I check the try-on before shoppers see it?

Yes, with test mode. In WooCommerce → Settings → LessLens Try-On, tick "Test mode", then open a product page with ?lltest=1 at the end of its address (for example https://your-store.com/product/your-frame/?lltest=1). That browser tab shows the button on every product page until you close it. Everyone else gets no button, and nothing is loaded from LessLens for them. The check happens in the visitor's browser, so it works with page caching. Untick "Test mode" to show the button to all shoppers. If your caching plugin keeps pages for a long time, clear its cache after switching test mode on or off.

Does it work with block themes?

Yes. In block themes such as Twenty Twenty-Five and in classic themes such as Storefront, the button goes under Add to cart (or under the title and price) by itself, with WooCommerce's "Add to Cart Form" block and with its newer "Add to Cart + Options" block. If your Single Product template has no Add to cart form, or you want the button somewhere else, turn off "Show the button on product pages automatically" and add a Shortcode block with [lesslens_tryon] to the template (Appearance → Editor → Templates → Single Product). The shortcode also works in the product's short description or description. When you place the shortcode yourself, turn the automatic placement off, and use the shortcode once per page. (With the automatic placement on, the automatic button steps aside only for a shortcode in the product's description or short description, in the Single Product template's own content, or one that appears on the page before the automatic button's place. A shortcode in a template part, synced pattern, widget or page-builder layout that comes after it stays empty, and the automatic button stays.)

Will it slow down my product pages?

On product pages that get a placeholder (see "External services"), the plugin adds the LessLens script as a module, which runs only after the page has been read, and a small script of its own (no libraries) that picks where in your product gallery the try-on opens. Variable products also get a second small script that switches the button to the picked colour. On a page with a try-on button, the try-on's public files are downloaded in the background only after the page has finished loading, once per store, and not on slow connections or when the browser asks to save data. The camera, the session and your frame's 3D model start only when the shopper taps the button. Other pages get nothing.

Do I need to change my caching or JavaScript optimisation plugin?

Usually not. Page caching is fine. Autoptimize and W3 Total Cache leave the LessLens script alone, and the plugin keeps it out of SiteGround Speed Optimizer's "Combine JavaScript Files" and out of WP-Optimize's JavaScript minifying, merging and "Delay JavaScript", so the button works with those options on. One exception: in WP-Optimize, leave "Contain each included file in its own block" off (it is off unless you turn it on); with it on, the button doesn't show. With another optimiser (WP Rocket, LiteSpeed Cache, Perfmatters and the like), if the button doesn't show, exclude cdn.lesslens.app (the script tryon-button.js) from its "combine", "minify", "delay" or "defer" JavaScript options. The LessLens script finds the LessLens service from its own address, so a copy combined into another file or served from your own site doesn't work, and a delayed one shows the button only after the shopper first scrolls or moves the mouse.

Does my store need HTTPS?

Yes. The LessLens service accepts only pages on https:// (plain http:// only on localhost and 127.0.0.1, for testing), and only on the domains LessLens has on file for your store.

I used the LessLens code snippet before. What now?

Remove the snippet (in Code Snippets, WPCode or your child theme's functions.php) before you activate the plugin, then save your store key in the plugin's settings. Your key and frames stay the same. While the snippet is still active, the plugin adds nothing to product pages, so shoppers never get two buttons, and a notice in wp-admin reminds you to remove it.

Can I measure the effect?

Yes. The try-on fires these events on your page (on window) for your own analytics: lesslens:view (the button is shown, once per frame per page), lesslens:open (the try-on is opened), lesslens:tryon (the frame is on the face, from the camera or a photo) and lesslens:photo (the shopper shares or saves a try-on photo). With "Send try-on events to the dataLayer" on, Google Tag Manager gets them as lesslens_view, lesslens_open, lesslens_tryon and lesslens_photo, with the frame in lesslens_model. (The LessLens script also has lesslens_holdout, for an A/B test that holds the button back; the plugin doesn't set up such a test, so it doesn't fire.) A pupillary distance the shopper types in comes as lesslens:pd on your page only, never in the dataLayer. LessLens also sends you a monthly report of button views and try-ons by frame.

Do shoppers' camera images leave their device?

No. The camera image is processed on the shopper's device, and LessLens doesn't receive or store it. See "External services" above for everything the try-on sends.

更新日志:

1.0.3 1.0.2 1.0.1 1.0.0