| 开发者 | extendiment |
|---|---|
| 更新时间 | 2026年10月13日 23:19 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
{qty} for the units left and {product} for the product name. Bold text and links are allowed, e.g. Sold out, <a href="/contact">ask us about restocking</a>.
For developers
stockline_stock_html filters the final markup ($html, $product, $state).stockline_states, stockline_state and stockline_placeholders let other plugins add a state with its own message, icon and colour, and placeholders for it. Preorderline uses them for a "Pre-order" state with {date}.stockline_product_settings lets a plugin give a product or variation its own message, icon or colour, and stockline_page_colors adds the colours it uses to the page's stylesheet.stockline_enqueue_styles loads the small stylesheet beyond product pages, e.g. for a Single Product block on a landing page.stockline_loaded fires once Stockline has loaded, for add-ons.No. Stockline only changes the message shoppers see. Stock levels, backorders and the low stock threshold are still WooCommerce's settings.
From WooCommerce: the product's own low stock threshold, or the store-wide one under WooCommerce → Settings → Products → Inventory.
WooCommerce shows nothing for in-stock products that don't track stock. Set an In stock message in Stockline to show one there too.
Stockline's messages, icons and colours apply to the whole store. Variations show the store's message for their stock state, with their own quantity in {qty}.
Yes. The product page in block themes renders stock through the same WooCommerce function Stockline hooks into.
Yes. The line has the classes stockline, stockline--{state} (in-stock, low-stock, backorder, out-of-stock) and stockline--plain or stockline--badge, plus WooCommerce's own stock classes. The colour is a CSS variable, --stockline-color, set by a stockline--color-{hex} class (e.g. stockline--color-cf222e).
Usually a page cache: clear your caching plugin's or host's cache and reload the product page. If it still shows WooCommerce's text, check that the message for that state isn't empty (empty keeps WooCommerce's wording) and that your theme shows the stock line at all.
When you click Deactivate on the Plugins screen, Stockline asks what should happen to its data if you then delete the plugin. Keep it (the default) and your stock messages, icons and colours are still there if you install Stockline again. Choose Delete it permanently when the plugin is deleted to have them removed when you delete it. Deactivating alone never removes anything, and your products and their stock levels are never deleted.
Yes, on translate.wordpress.org. The template is also included as languages/stockline.pot for tools such as Poedit or Loco Translate.