Skip to content

Inventory forecasting

The inventory forecasting module analyzes sales velocity from the last 90 days and predicts the stock depletion date for each product. The dashboard lets you quickly identify products that need restocking.

  1. The plugin fetches sales data from the last 90 days (orders with completed and processing status)
  2. It calculates the average daily sales (sales velocity) for each product
  3. Based on the current stock level and average sales, it predicts the depletion date
  4. Products are classified by restocking urgency
  5. Results are cached in a transient for 1 hour

Go to WooCommerce > Inventory forecast to open the forecasting dashboard.

Three status cards are displayed at the top of the dashboard:

CardConditionColor
CriticalDepletion within 7 daysRed
WarningDepletion within 30 daysYellow
HealthyDepletion in 30+ daysGreen

Each card shows the number of products in that category.

Below the cards a table is displayed with details for each product:

ColumnDescription
ProductProduct name with a link to the editor
Current stockCurrent quantity in stock
Average daily salesAverage number of units sold per day (over 90 days)
Days to depletionEstimated number of days until zero stock
Forecast datePredicted stock depletion date
Suggested orderRecommended quantity to order (30-day coverage)

The table is sorted by default on the “Days to depletion” column (ascending), so the products that need restocking soonest appear at the top.

The suggested order quantity is calculated using the formula:

suggested_order = average_daily_sales * 30

This value represents the quantity covering 30 days of demand.

The module adds a Forecast column to the products list (Products > All products). The column displays the estimated number of days to stock depletion with a colored indicator:

  • Red (critical): fewer than 7 days
  • Yellow (warning): 7-30 days
  • Green (healthy): more than 30 days

Products without stock tracking or with stock management disabled do not display a forecast.

Sales data is fetched directly from the database using a SQL query on the tables:

  • {prefix}woocommerce_order_items - order line items
  • {prefix}woocommerce_order_itemmeta - line item metadata (quantity, product_id)

Only orders with wc-completed and wc-processing status from the last 90 days are taken into account.

Forecasting results are stored in the WordPress transient cache with a lifetime of 1 hour:

  • Transient key: polski_pro_inventory_forecast
  • Expiration time: 3600 seconds (1 hour)
  • The cache is automatically refreshed after expiration

This avoids slow SQL queries on every dashboard load.

The module is controlled by a toggle:

WooCommerce > Settings > Polski PRO > Modules > inventory_forecast

After enabling the module, the Inventory forecast item appears automatically in the WooCommerce menu.

This page is for informational purposes only and does not constitute legal advice. Polski PRO for WooCommerce is commercial software provided without warranty.