
外掛標籤
開發者團隊
原文外掛簡介
LanternWP Companion is the plugin of LanternWP, a block theme for WooCommerce (https://wordpress.org/themes/lanternwp/). With it, your store gets:
A complete store to start from: one of six LanternWP demo stores, with its products, photos, pages, menus and look, imported while your store keeps its own settings.
16 store features as blocks that extend WooCommerce’s own: on product cards, on the product page, in the cart and around the store.
One screen for all of them, Appearance → LanternWP → Features, with each feature’s switch, whether it works and where it is set.
Every feature and every public demo is free. There is no paid version and no license key.
Companion is made for the LanternWP theme, or a child theme of it, and tested with it; the demo import needs it. The theme works without Companion as a complete store; Companion adds what belongs in a plugin rather than a theme. It needs WooCommerce 11.1 or later: install and activate WooCommerce first, since WordPress does not activate Companion without it.
Demo stores
Each demo is a complete WooCommerce store: products with photos, categories, pages, menus, a journal, a customer with orders, and the store’s look.
Common Goods: everyday goods in natural materials, made in short runs. Its look is the theme’s own.
Voltline: electronics for the desk and the road, on a dark storefront.
Kilowatt: electronics and appliances, with departments, deals and store pickup.
Halden: skincare, one good cream and a short routine around it.
Tessel: basics for women and men, in the weights and fits you wear every day.
Transom: furniture made to fit the room you have, with fabrics, finishes and sizes to choose.
Import one in Appearance → LanternWP → Demos:
Your store keeps its own settings (name, currency, address, units, taxes, payments, shipping); when the import is done it lists what is still to set up, with links.
The progress shows stage by stage, in short steps, so a host with tight limits can import too.
Undo last import puts back the homepage, header, footer, menus, Styles and features the last import changed; the demo’s products and pages stay. Update to version N brings a newer version of the demo.
The demo’s look goes into Styles, so it stays without the plugin; Use the look only takes the look without the content.
The demos’ photographs are released under CC0 1.0: keep them, change them or use them elsewhere.
The same import from WP-CLI: wp lanternwp demo import base.
On product cards
Product badges: Bestseller and New badges, set on the product or by rules.
Product swatches: a product’s colors as swatches on its card.
Second photo on hover: a product’s second photo on its card while the pointer rests on it.
Quick view: a product’s photos, options and Add to cart over the catalog.
On the product page
Size & option guides: a link beside a product option, such as Size, that opens its guide.
How it fits: the cut and the model’s height and size, under a product’s sizes.
Fit in reviews: the review form asks how it fits, and the product page shows what reviewers say.
Back-in-stock emails: shoppers ask to hear when a sold-out product or option is back.
Lowest price before a discount: the lowest price of the 30 days before a sale, as the EU’s Omnibus Directive requires.
Dimensions: a product’s size in an in/cm table with its drawing.
Samples: fabric or finish samples of an attribute’s values, ordered from the product page.
Shipping times: how long a product takes to ship, from its shipping class.
In the cart and around the store
Product sets: products that go together, with a shoppable photo, added to the cart together.
Free shipping progress: how far the cart is from free shipping.
Contact form: messages kept under WooCommerce → Messages and emailed to the store.
Bot protection: Cloudflare Turnstile on sign-in, registration and forms.
With the LanternWP theme, the plugin also keeps Store pages (Settings → Reading), Store phone (WooCommerce → Settings → General) and a post’s Shop the story products. WooCommerce’s sale badge reads the discount (−20%) instead of Sale.
Each feature has its page in the LanternWP handbook, with every setting and where it is: https://lanternwp.com/docs/
External services
The demo import downloads LanternWP demo stores from the demo store at lanternwp.com, run by LanternWP (Testica Iga Małłek, Poland). Nothing reaches lanternwp.com until a site administrator selects Show the demos from lanternwp.com in Appearance → LanternWP → Demos, which says first what that means; Stop loading from lanternwp.com on the same screen withdraws it. From then on, the plugin asks it for the list of demos when an administrator opens Demos (kept for an hour), and for a demo’s list of versions and files and the files themselves when an administrator runs an import or uses a demo’s look there, only its manifest for a look (https://lanternwp.com/api/demos/), which it checks against their checksums; the administrator’s browser also loads each demo’s logo or screenshot from lanternwp.com on the Demos screen. The WP-CLI commands wp lanternwp demo import (and look) and wp lanternwp account ask lanternwp.com when someone runs them, as their own request, without the screen’s yes, and do not give it. The requests carry what every request from WordPress carries: the site’s IP address and WordPress’s user agent, which names the WordPress version and the site’s address. Nothing else is sent for the public demos.
A site can also be connected to a lanternwp.com account, to list and import the private demos made for that store; this happens only when a site administrator selects Connect to lanternwp.com in Demos, which shows it only once the demos are allowed there, or runs wp lanternwp account connect. Connecting sends the administrator’s browser to lanternwp.com (https://lanternwp.com/connect/authorize) with the address lanternwp.com answers to (the site’s admin-post.php), a random state and a PKCE code challenge; the administrator signs in and allows the connection there. The site then sends lanternwp.com the code it got back, its PKCE verifier and the same address (https://lanternwp.com/api/connect/token) and keeps the connection token, the account’s e-mail address and the connection’s name it receives. While the site is connected and the demos are allowed, the Demos screen sends that token, in the Authorization header, to lanternwp.com’s account routes (https://lanternwp.com/api/account/) to fetch the account’s demos (kept for an hour, and not asked for while an import step keeps the site busy for longer than ten seconds) and their logos and screenshots, which the site passes on to the administrator’s browser, and an import or a look of one of those demos sends it to fetch the demo’s versions and files; no request for a public demo carries it. WP-CLI’s wp lanternwp account connect sends the token to fetch the account and connection it belongs to, and wp lanternwp demo sends it only when the public routes say there is no such demo (not a version of a demo they have), while the site is connected to an account of the server it names: to fetch the account’s demos, once, then that demo’s versions and files if the account has it. Disconnecting asks lanternwp.com once to end the connection, unless the site’s address changed since it connected (the token may then be another site’s), and the site forgets it whatever lanternwp.com answers; when lanternwp.com could not be told, the screen and WP-CLI say so, and the account ends it in its settings. Every request with the token is sent only while it is still the site’s connection and, from the Demos screen, while the demos are still allowed; the request that ends the connection is sent without the yes. Until the demos are allowed on the Demos screen, the screen sends nothing for a connection made with WP-CLI: it shows the account and the site’s name in it from what the site keeps, neither Connect nor Disconnect, and Forget this connection, which deletes it from the site and sends nothing. Stop loading from lanternwp.com withdraws the yes at once, then disconnects a connected site as Disconnect does; while an import step keeps the site busy for longer than a quarter of a minute, the connection stays, and the screen says so and offers to forget it. When lanternwp.com asks the site to wait (429), a step of the Demos screen’s import is tried again up to five times, each no sooner than lanternwp.com asks, and WP-CLI asks an account route up to three times, waiting as long as lanternwp.com asks when that is two minutes or less (the account’s list for a demo the public routes do not have, and Disconnect, are asked once). A copy of the site at another address does not use the connection; a copy at the same address cannot be told from the site and uses it. The token goes to no other address, no request with it follows a redirect, and each checks lanternwp.com’s certificate. As with every request WordPress sends, another plugin’s HTTP filters on the site can read the request’s headers, the token among them. Nothing else is sent. Privacy policy: https://lanternwp.com/privacy, terms of use: https://lanternwp.com/terms
Bot protection, while a store has turned it on, uses Cloudflare Turnstile, run by Cloudflare, Inc. The visitor’s browser loads Turnstile’s script (https://challenges.cloudflare.com/turnstile/v0/api.js) on a page with a protected form (for back-in-stock requests, once their form shows), and Turnstile reads information about the browser and device to tell a person from a bot. When the form is sent, the site sends Cloudflare the form’s token, the store’s secret key and the visitor’s IP address to check it (https://challenges.cloudflare.com/turnstile/v0/siteverify); saving the settings sends the secret key with a test token. Once a site key is saved, opening Bot protection’s details in Appearance → LanternWP → Features also loads Turnstile’s script in the administrator’s browser, with that key, to check that Cloudflare accepts it before shoppers meet it, also while Bot protection is still off. Terms: https://www.cloudflare.com/website-terms/, privacy policy: https://www.cloudflare.com/privacypolicy/
The demo photographs are licensed under CC0 1.0.
Source code and build
The complete TypeScript and CSS sources are included in resources/, with the shared editor components in resources/editor-ui/. PHP and block stylesheets are used directly. The JavaScript and admin stylesheets in build/ are compiled from these sources with @wordpress/scripts (webpack).
