| 开发者 | piotr-pesta |
|---|---|
| 更新时间 | 2026年12月3日 18:26 |
| PHP版本: | 8.3 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
{lead_time} to display the effective value in a stock message. A message using the token updates when its inherited lead time changes.{lead_time}.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.
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.
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.
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.
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.
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.
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.
Deactivation restores the WooCommerce display and keeps your settings. Deleting the plugin removes its settings from the installation.
{lead_time} token.