How to Bulk Reset WooCommerce Product Stock Daily

  • March 31, 2026
  • Deepak Gupta
  • 4 min read

In this tutorial, I’ll show you how to set up an automatic product stock reset in a WooCommerce store. Whether you’re a WordPress Developer, Woocommerce Developer, Plugin Developer, or even a Full Stack Developer or Mern stack Developer working with Headless Woocommerce or Woocommerce Headless setups, this functionality can be extremely useful.

For example, let’s assume that “Product A” has a stock quantity of “10” at the beginning of the day. During the day, it may have multiple sales, but it doesn’t matter how many—it should return to “10” the next morning.

You may need this as part of risk management, limited inventory campaigns, or controlled digital product sales.

Below, we’ll explore two methods to achieve automatic stock reset:

  • Programmatic approach
  • Plugin-based approach using multiple stores

Method 1. Programmatically

Let’s start with the programmatic method. This approach is ideal for a Plugin Developer or Full Stack Developer who prefers complete control.

Bulk Update Product Stock Quantities

First, we need to define the original stock values.

$set_stock_quantities = array(
5 => 10,
15 => 110,

// etc.
);

You can include both product IDs and variation IDs.

Now, let’s update stock in bulk:

foreach( $set_stock_quantities as $product_id => $stock_qty ) {

$product = wc_get_product( $product_id );
if( ! $product ) {
continue;
}

$product->set_stock_quantity( $stock_qty );
$product->save();

}

How it works:

  • We define stock values manually
  • Loop through products
  • Reset stock quantities

This method works well even in Woocommerce Headless environments where backend logic is separated.

Reset Product Stock Daily Using Action Scheduler

Now let’s automate it.

We will:

  • Create a custom action hook
  • Schedule it using WooCommerce Action Scheduler
add_action( 'dk_reset_stock', function() {

$set_stock_quantities = array(
5 => 10,
15 => 110,
);

foreach( $set_stock_quantities as $product_id => $stock_qty ) {

$product = wc_get_product( $product_id );
if( ! $product ) {
continue;
}

$product->set_stock_quantity( $stock_qty );
$product->save();

}

} );

Run this once to schedule:

$timestamp = strtotime( 'tomorrow 01:00:00', current_time( 'timestamp' ) );
as_schedule_recurring_action( $timestamp, DAY_IN_SECONDS, 'dk_reset_stock' );

This setup is commonly used by a WordPress Developer or Woocommerce Developer to automate store operations.

Method 2. Using Two WooCommerce Stores and a Plugin

This method is useful for businesses managing multiple stores.

A Woocommerce Developer or Mern stack Developer working with Headless Woocommerce often uses this architecture.

Step 1. Connect “Store 2” to “Store 1”

Define roles:

StoreDescription
Store 1Manage stock and data
Store 2Live customer-facing store

Connection methods:

  • Multisite → Select store directly
  • Separate stores → Use REST API (consumer key & secret)

This setup is common in Woocommerce Headless systems where frontend and backend are separated.

Step 2. Run Bulk Stock Resync

You can manually sync stock from:

WooCommerce → Status → Tools

But for automation, use this snippet:

add_action( 'dk_start_inventory_sync', function( $store_id_or_url ) {

$hook_name = is_numeric( $store_id_or_url ) ? 'dk_isfw_resync_wpmu' : 'dk_isfw_resync';

if( false === as_next_scheduled_action( $hook_name, array( 'store' => (string) $store_id_or_url ) ) ) {
as_schedule_recurring_action( time(), MINUTE_IN_SECONDS, $hook_name, array( 'store' => $store_id_or_url ) );
}} );

Schedule it:

$timestamp = strtotime( 'tomorrow 01:00:00', current_time( 'timestamp' ) );
$store_id_or_url = 'store2.example.com';
$interval_in_seconds = DAY_IN_SECONDS;as_schedule_recurring_action( $timestamp, $interval_in_seconds, 'dk_start_inventory_sync', array( 'store' => $store_id_or_url ) );

When Should You Use Each Method?

Use Programmatic Method if:

  • You are a Plugin Developer or Full Stack Developer
  • You want full control
  • You manage a single store

Use Multi-Store Sync if:

  • You manage multiple stores
  • You use Headless Woocommerce
  • You want separation between admin and live store

Best Practices

To make this system reliable:

  • Avoid hardcoding too many products
  • Store stock data in CSV or database
  • Use proper scheduling intervals
  • Monitor cron jobs regularly
  • Optimize queries for performance

A Mern stack Developer can also integrate APIs for advanced automation in Woocommerce Headless setups.

Final Thoughts

Bulk resetting WooCommerce product stock daily is a powerful feature for managing inventory, running limited campaigns, and improving store control.

Whether you implement it programmatically or via store synchronization, the approach depends on your setup.

For a WordPress Developer, Woocommerce Developer, or Full Stack Developer, this is a must-have automation technique—especially when working with scalable or Headless Woocommerce architectures.

If you want to add this feature to the plugin, please let me know in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *