Linux 软件免费装
Banner图

Custom Availability Messages for WooCommerce

开发者 piotr-pesta
更新时间 2026年12月3日 18:26
PHP版本: 8.3 及以上
WordPress版本: 7.1
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

woocommerce product availability backorders stock status lead time

下载

1.0.0 1.0.1

详情介绍:

Give shoppers clearer product availability messages and tell them when an order is expected to ship. Set store-wide defaults and override them for a category, product or variation. Edit each stock state separately and see the result in the live preview before saving. Stock messages for each product Dispatch lead times Dispatch lead time is the time until a product is shipped. Delivery time also includes the carrier's transit time after dispatch. Examples The plugin supports classic WooCommerce product pages and the Product Stock Indicator block, including variation selection. It is compatible with High-Performance Order Storage (HPOS). WooCommerce still controls stock levels, stock status, pricing and checkout. The plugin is free and WooCommerce is its only plugin dependency. External integrations can read the effective dispatch time through the PHP API.

安装:

  1. Use WordPress 7.0 or later, PHP 8.3 or later and an active installation of WooCommerce 11.2 or later.
  2. Install and activate Custom Availability Messages for WooCommerce.
  3. Go to Plugins > Installed Plugins and select Settings below the plugin name. This opens WooCommerce > Settings > Products > Availability messages. Expand Getting started for a quick guide.
  4. To add an override, edit a product category, open Product data > Inventory for a product, or expand Availability messages inside a variation.

屏幕截图:

  • Token replacement and the live preview for a saved message using the short calendar-day label.
  • Availability rules and category priority in the product category editor.
  • Availability messages under Product data > Inventory for an individual product.
  • Availability messages for an individual variation under Product data > Variations.
  • A dispatch message on the public product page.
  • The Settings link on the Installed Plugins screen.
  • The in-stock dispatch message when a shopper selects one unit.
  • The backorder message when the shopper selects more than the stocked quantity.

常见问题:

Which rule takes precedence?

For each stock state, the plugin checks the variation, the product, its directly assigned categories, their ancestors and global settings in that order. Within each category group, higher priority numbers win. Ties use category depth and then the lowest category ID. If no Low stock rule applies, the plugin checks the In stock hierarchy. If no message applies, WooCommerce uses its default.

What happens when I hide a message or leave it blank?

Hide stops message inheritance and removes the stock message. A blank custom message inherits. Hiding a message still lets integrations read its effective dispatch time.

How do I add a dispatch time to a message?

Open Dispatch lead time and enter a minimum. Leave the maximum blank for a single value. Zero is accepted. Inherit looks for a rule in the next scope. No lead time stops numeric inheritance. Under Custom message, enable Replace the token with the effective lead time, then use Insert {lead_time} and check the result in the live preview. If the time is missing, the message falls back to your optional text or the applicable WooCommerce default.

Can I keep an inherited lead time and show a shorter unit?

Yes. When the effective unit is Calendar days, choose Use short unit name to show a value such as 5–7 days, or Use full unit name to show 5–7 calendar days. The wording preference inherits independently of the numeric rule. When no preference applies, the full label is used.

How can an integration read the dispatch time?

After WooCommerce has initialized, call \PiotrPesta\CustomAvailabilityMessages\get_effective_lead_time( $product_or_id, $state ). Pass a variation ID or its WooCommerce object to resolve that variation. Omit the state to use the current presentation state. The API returns the unit, minimum, maximum, status and source. It returns calendar_days for both calendar-day labels and null for an invalid product or state. Check that the function is callable before using it. The installable ZIP includes the full contract in docs/public-api.md.

Does the plugin calculate delivery dates or sync with Google Merchant Center?

CAM displays the configured time until dispatch. It does not calculate delivery dates, manage a holiday calendar or sync with Google Merchant Center on its own. External integrations can read the effective dispatch time through the PHP API.

Can the message change when shoppers select a larger quantity?

Yes. The classic WooCommerce product form and the Product Stock Indicator inside the Add to Cart with Options block can switch from the in-stock or low-stock message to the backorder message. WooCommerce must track the stock and allow backorders. The change reflects the quantity selected on the product page. It does not include units already in the cart. WooCommerce still validates purchases and stock. The browser compares the selected quantity with the in-stock threshold without making a request. If WooCommerce hides that stock count, CAM leaves the feature off unless you enable Allow this also when stock quantities are hidden under Dynamic availability messages, immediately below Getting started. Enabling it lets a visitor determine the threshold. Without JavaScript, the original message remains.

What happens when I deactivate or delete the plugin?

Deactivation restores the WooCommerce display and keeps your settings. Deleting the plugin removes its settings from the installation.

更新日志:

1.0.1 1.0.0