| 开发者 | lesslens |
|---|---|
| 更新时间 | 2026年11月27日 21:24 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.2 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[lesslens_tryon] shortcode.?lltest=1 shows the button, and nothing is loaded from LessLens for anyone else.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).
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.http:// only on localhost, for testing.
Used the LessLens code snippet before the plugin? Remove the snippet first (see the FAQ).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.
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.
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).
Check these, in this order:
pk_). A value that isn't a store key is saved with a warning, and product pages stay as they are.?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.https:// pages. Tell us any domain that is missing.[lesslens_tryon] shortcode (see "Does it work with block themes?").lesslens_tryon_show_button filter on your site returns false for that product.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.
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.
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 );
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.
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.
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).
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.
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).
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.
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.)
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.
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.
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.
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.
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.
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.
?lltest=1 shows the button; everyone else gets nothing from LessLens. Works with page caching.[lesslens_tryon] shortcode, the dataLayer option and the lesslens_tryon_show_button filter. Keeps the LessLens script out of SiteGround Speed Optimizer's JavaScript combining and out of WP-Optimize's JavaScript processing and delay, and hides WooCommerce's photo zoom icon while the try-on is open, so it doesn't cover the try-on's close button.