To show recently restocked products in WooCommerce, add the [alg_wc_stock_snapshot_restocked] shortcode from Stock History & Reports Manager for WooCommerce to any page. It displays in-stock products whose stock went up in their latest snapshot, as a standard product grid. The shortcode is listed under WPFactory > Stock Snapshot > General > Shortcodes.
![a front-end "Back in stock" page built with the [alg_wc_stock_snapshot_restocked] shortcode](https://wpfactory.com/wp-content/uploads/stock-history-restocked-products-1.png)
Before you start #
- Products need Manage stock? enabled and at least two snapshots, so there is a previous quantity to compare with.
- The shortcode is free.
Steps #
- Go to Pages > Add New Page and give it a title, such as “Back in Stock”.
- Add a Shortcode block with:
[alg_wc_stock_snapshot_restocked columns="4" orderby="last_restocked" order="DESC" total_snapshots="3"]
- Publish the page and view it.
How “restocked” is decided #
For each in-stock product, the shortcode compares the latest snapshot with earlier ones:
- It looks back up to
total_snapshotssnapshots (default 1, the one just before the latest). - If the latest quantity is higher than one of those earlier quantities by at least
min_stock_diff(default 1), the product is listed. - A product with only one snapshot is listed only when
new_stock="yes"and its stock is above 0.
Because periodic snapshots record every product, an unchanged quantity at the next scheduled snapshot pushes the restock further back. With the default total_snapshots="1", a product drops off the list after the next snapshot that records no change. Raise total_snapshots to keep restocked items visible longer. For example, with daily snapshots, total_snapshots="7" covers about a week.
Shortcode attributes #
| Attribute | What it does | Default |
|---|---|---|
min_stock_diff |
Minimum stock increase to count as a restock. | 1 |
total_snapshots |
How many earlier snapshots to compare with. | 1 |
new_stock |
yes also lists products with a single snapshot and stock above 0. |
no |
columns |
Number of grid columns. | 4 |
paginate |
yes adds pagination to the grid. |
no |
orderby |
Sort order: name, ID, date, modified, rand and other standard WooCommerce values, or last_restocked to sort by restock time. |
name |
order |
ASC or DESC. |
ASC |
not_found_msg |
Message shown when nothing matches. | <p>No restocked products found.</p> |
The shortcode also works with the brand filter widget from the Perfect Brands for WooCommerce plugin: when a brand filter is active, the list is limited to those brands.
Frequently asked questions #
Why is the restocked list empty? #
No in-stock product has a recent increase. Check that products have at least two snapshots and that the latest is higher than the one before. Try total_snapshots="7" to look further back, or new_stock="yes" for newly tracked products.
How quickly does the list update after I restock? #
Results are cached, and the cache is cleared every time a snapshot is taken or the plugin settings are saved. Updating a product’s stock records a snapshot, so the list refreshes on the next page view. If you use page caching, clear that too.
Can I show the newest restocks first? #
Yes. Use orderby="last_restocked" order="DESC".
Are out-of-stock products ever shown? #
No. Only products with the In stock status are checked.
Get more from Stock History #
This shortcode is free. Stock History & Reports Manager for WooCommerce Pro adds a daily restocked-products email for your team. See what Pro unlocks.
Need a hand? Our team answers every ticket on the Stock History support forum.