Skip to content

Inventory forecasting

The Inventory forecast module in Polski PRO divides each product's units sold in completed and processing orders over the last 90 days by 90, then estimates the date its stock runs out. It adds a Stock Forecast column to the product list and a WooCommerce > Inventory Forecast screen. Only products with stock management enabled get a forecast.

  1. The plugin sums the quantity sold of each product in orders with wc-completed or wc-processing status created in the last 90 days
  2. Average daily sales = units sold / 90
  3. Days to depletion = current stock / average daily sales, rounded up
  4. The depletion date is today plus that number of days
  5. Products are classified by how soon they run out

The calculation is a plain 90-day average. It does not weight recent days more heavily and does not account for seasonality.

The module is off by default. Turn on Inventory forecast (group Tools) on the Polski modules screen (module key inventory_forecast):

Polski > Modules > Inventory forecast

After enabling the module, the Inventory Forecast item appears in the WooCommerce menu. It requires the manage_woocommerce capability. The module has no other settings.

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

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

Card Condition Color
Critical (< 7 days) Depletion in 7 days or fewer Red
Warning (< 30 days) Depletion in 8 to 30 days Yellow
Healthy (30+ days) Depletion in more than 30 days Green

Each card shows the number of products in that category. Critical rows in the table get a light red background, warning rows a light yellow one.

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

Column Description
Product Product name with a link to the editor, followed by the SKU
Current Stock Current quantity in stock
Avg. Daily Sales Average units sold per day over 90 days, one decimal place
Days Until Depletion Estimated number of days until zero stock
Estimated Depletion Predicted depletion date (YYYY-MM-DD)
Suggested Reorder Quantity covering 30 days of demand

The table is sorted by "Days Until Depletion" ascending, so the products that need restocking soonest are at the top.

The dashboard lists a product only when all of these are true:

Condition Products left out
Published Drafts, private and pending products
Stock management enabled Products without stock tracking
Stock status "In stock" and quantity above 0 Out-of-stock products
At least one unit sold in the last 90 days Products with no recent sales

If no product passes, the screen shows "No products with stock management enabled."

suggested_reorder = max(1, ceil(average_daily_sales * 30))

The value covers 30 days of demand and is never lower than 1.

The module adds a Stock Forecast column to the products list (Products > All products). It can show:

Value When
-- (grey) Stock management is off for the product
Out of stock (red) Stock quantity is 0 or lower
No recent sales (green) Nothing sold in the last 90 days
N days, red warning icon 7 days or fewer
N days, yellow warning icon 8 to 30 days
N days, green check More than 30 days

Hovering over the day count shows the depletion date and the velocity per day.

Sales are read with a SQL query on:

  • {prefix}woocommerce_order_items - order line items
  • {prefix}woocommerce_order_itemmeta - line item metadata (_qty, _product_id)
  • {prefix}wc_orders when HPOS is active, otherwise {prefix}posts

Sales are matched on _product_id, so sales of variations count toward their parent product. Variations are not listed as separate rows.

Data Transient key Lifetime
Full dashboard result polski_inventory_forecast 1 hour (3600 s)
Daily sales velocity of one product polski_velocity_{product_id} 1 hour (3600 s)

When the dashboard cache is cold, the next visit to the screen rebuilds it. It walks published products in batches of 100 and runs one sales query per stocked product, so on a large catalog that first load is slower.

Why is a product missing from the Inventory Forecast dashboard?

Section titled "Why is a product missing from the Inventory Forecast dashboard?"

It is either not published, has stock management off, is out of stock, or sold nothing in the last 90 days. The Stock Forecast column in the product list shows whether stock management is off, the product is out of stock or it has no recent sales.

Only orders with Completed or Processing status created in the last 90 days. Pending, on-hold, cancelled and refunded orders are ignored.

Results are cached for one hour, both for the whole dashboard and per product. After that the next page load recalculates them.

Yes. The sales query reads the wc_orders table when HPOS is active and the posts table otherwise.

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