Skip to main content

How to Enable Real-time Stock Refresh in WooCommerce

Real-time Stock Refresh is a feature in the NitroPack WordPress plugin that keeps your product availability accurate by automatically updating stock levels on your site.

⚠️ Requirements: This feature is available only for websites using WooCommerce and NitroPack version 1.12.0 or newer.

Default Stock Behavior

NitroPack automatically refreshes the cache when a product goes out of stock or comes back in stock. This ensures accurate availability without any extra configuration.

  • Scenario: If a customer buys the last item (stock reaches 0), NitroPack refreshes the cache for the product page and related pages (category and shop pages).

  • Restocking: The same refresh occurs when you restock a product from 0 to any positive number.

  • Compatibility: This works regardless of how stock is updated - via the WordPress admin, WooCommerce REST API, or third-party inventory plugins.

What Changed in Version 1.19.4?

Starting with version 1.19.4, NitroPack no longer triggers a cache refresh when only the stock quantity changes but the product remains in stock (e.g., dropping from 50 to 45).

  • The Benefit: Reduces unnecessary cache purges for high-volume stores, keeping the site faster.

  • Exceptions: If other data changes (price, title, or description), the cache will still refresh as expected.

When to Use Real-time Stock Refresh

Usage

Recommendation

βœ… Use it when:

You show exact stock quantities (e.g., "Only 3 left in stock"). It ensures visitors always see the current number.

🚫 Do not use it when:

You only display "In Stock" or "Out of Stock". Default behavior already handles this; the extra toggle is unnecessary.

How Real-time Stock Refresh Works (v1.19.4+)

When enabled, NitroPack handles updates in two ways:

  1. Status Changes (0 to 1+ or 1 to 0): The cache is refreshed for the product page and all related pages (category and shop).

  2. Quantity Changes (Still in stock): Only the product page cache is refreshed. Category and shop pages are not affected to maintain efficiency.

When to Use Real-time Stock Refresh

βœ… Use it when: You show exact stock quantities on your site.

🚫 Do not use it when: You only display products as available without showing the exact quantities. The cache will be cleared after every order, which isn't necessary.

How to Enable via WordPress

  1. Navigate to your WordPress admin panel and go to the NitroPack plugin settings.

  2. Under the Settings panel, locate the Real-time Stock Refresh feature.

How to Verify it’s Working

  1. Open your WooCommerce product page, right-click, and select Inspect.

  2. Navigate to Network > Doc and refresh the page. Look for a "HIT" in the headers, indicating the cache is active.

3. Make a purchase or reduce stock manually, then refresh again.

4. You should see a "MISS" (the refresh) followed by a "HIT" on the next load, confirming the stock levels updated correctly.

Did this answer your question?