Inventory Reservation Cleaner for Magento 2

Kowal_ReservationCleaner is a Magento 2 module designed for stores where stock levels are synchronized with ERP or WMS and the inventory_reservation table should not grow indefinitely.
Compatibility
2.4.9, 2.4.8, 2.4.7, 2.4.6, 2.4.5, 2.4.4, 2.4.3, 2.4.2, 2.4.1, 2.4.0
€30.75
per item
Email to a Friend

Enquire about this product

Description / Inventory Reservation Cleaner for Magento 2

MAGENTO 2 · ERP · MSI · SELECTED STOCKS

Clean MSI reservations in line with your ERP process.

Kowal Reservation Cleaner

In a specialized ERP-first implementation, run controlled reservation cleanup for the entire table or selected stocks. Choose the schedule, logging, reindexing, and process lock.

Cron or CLI · Log Only and Dry Run · Full or selective cleanup

HOW IT WORKS IN PRACTICE

01 · Define the synchronization model
Confirm when ERP provides the correct stock levels.

02 · Check the scope
Select stocks and review the Log Only or Dry Run result.

03 · Run the process
The schedule or CLI performs cleanup and optional reindexing.

What does your store gain?

Explore the module features, use cases, and settings.

Who this module is for

The module is a good fit if:

  • stock levels are regularly imported from ERP
  • Magento is not the primary inventory system
  • MSI reservations disrupt salable quantity
  • you need fast, predictable, and automatic reservation cleanup
  • the store runs on multiple stocks and cleanup should cover only selected ones

The module is not intended for stores that manage stock levels exclusively in Magento and rely on full real-time MSI logic.

The problem it solves

In standard Magento 2 with MSI, subsequent orders, cancellations, and shipments save data in inventory_reservation. In environments with ERP integration, these records often stop being operationally needed, but they still affect product availability and stock diagnostics.

Most common effects:

  • understated salable quantity
  • discrepancies between Magento and ERP
  • a growing number of records in inventory_reservation
  • more difficult inventory issue diagnostics
  • additional load for availability-related calculations

Key features

  • automatic execution from Magento CRON
  • manual execution via CLI
  • full_reset, log_only, and clean_after_erp_sync modes
  • lock to prevent parallel process execution
  • optional reindexing after cleanup
  • optional cache clean after completion
  • technical logging to a file
  • option to limit cleanup to selected stocks

How the module works

The module registers a CRON task that runs frequently, but actual execution happens only when the current time matches the configuration. This means the system schedule does not need to be dynamically rebuilt after every settings change.

Process flow:

  1. Check whether the module is enabled.
  2. Check whether the environment is allowed.
  3. Check the schedule.
  4. Apply the process lock.
  5. Count reservation records.
  6. Perform cleanup or logging only.
  7. Optional reindexing.
  8. Optional cache clean.
  9. Release the lock and write the log.

Full Reset

The simplest and fastest option for ERP-first stores.

When cleanup applies to all stocks, the module uses:

TRUNCATE TABLE inventory_reservation

This solution is the most efficient with a large number of records.

Log Only

Diagnostic mode. The module does not delete data and only counts records and writes the result to the log.

Clean After ERP Sync

A mode designed to run immediately after importing stock levels from ERP. Functionally, it cleans reservations in the same way as full_reset, but it organizes the implementation model and schedule.

Cleanup only for selected stocks

The module also supports a scenario where cleanup is performed only for specified stocks.

How it works:

  • if the stock list is empty, the entire reservation table is cleaned
  • if specific stocks are specified, the module deletes only records for those stock_id values

In this case, a selective query is used:

DELETE FROM inventory_reservation WHERE stock_id IN (...)

This approach is slower than TRUNCATE, but it allows you to keep reservations for the remaining stocks and provides more control in more complex implementations.

Business benefits

  • better stock level consistency between Magento and ERP
  • fewer errors related to salable quantity
  • simpler inventory diagnostics
  • lower risk of unnecessary data accumulating in MSI
  • implementation without disabling Magento MSI
  • a predictable and fast process that can be automated

Configuration

Admin panel:

Stores -> Configuration -> Kowal -> Reservation Cleaner

Key settings:

  • enable or disable the module
  • select the operating mode
  • execution hour and minute
  • select stocks for cleanup
  • enable reindexing
  • reindexing type
  • cache clean after the process
  • logging
  • lock validity time
  • limit operation to selected environments

Running from CLI

Basic command:

bin/magento kowal:reservation:clean

Example usage:

bin/magento kowal:reservation:clean --mode=full_resetbin/magento kowal:reservation:clean --mode=log_onlybin/magento kowal:reservation:clean --reindex=inventory_onlybin/magento kowal:reservation:clean --dry-run=1bin/magento kowal:reservation:clean --stocks=1,2

This lets you run the module manually, for testing, or directly after the ERP import is completed.

Logging and security

The technical log is written to:

var/log/kowal_reservation_cleaner.log

The module includes:

  • process lock
  • exception handling
  • environment control
  • time slot control
  • ability to work in log_only mode

Recommended implementation model

The most practical option for ERP-first stores:

  • full_reset mode
  • active logging
  • schedule started shortly after the ERP import
  • inventory_only reindexing or reindexing handled separately in the integration process
  • empty stock field for full cleanup, or specified stocks where a selective option is required

Limitations

This module:

  • does not fix MSI logic
  • does not reconstruct reservation history
  • does not replace a properly designed ERP integration
  • is not a universal solution for all Magento stores

It is a specialized tool for implementations where ERP manages the actual inventory state.

Package and module name

  • Magento module: Kowal_ReservationCleaner
  • Composer package: kowal/reservation-cleaner

CTA

Need implementation or module adjustment for ERP integration, multiple stocks, or a custom schedule? Contact us via kowal.store and describe your inventory synchronization model.

Cleanup deletes reservation history

Full Reset and Clean After ERP Sync delete reservation records within the selected scope. With an empty stock list, the process empties the entire inventory_reservation table; with specified stocks, it deletes only their records.

Implementation requires a model in which ERP provides the correct stock levels after the order process is taken into account. Deleting reservations alone does not confirm availability accuracy and does not restore MSI history.

Post-ERP mode and the actual trigger

The name clean_after_erp_sync describes the use case; it is not an automatic integration with the ERP import completion event. You organize execution after synchronization through CLI or a properly selected schedule.

Cron checks the configured time slot and environment. Environment handling uses APP_ENV or MAGENTO_ENV and the Magento mode. The lock limits parallel executions.

Pre-operation check

Log Only and --dry-run=1 are used to count records without deleting them. Verify stock_id, ERP import completion, and the expected salable quantity before enabling cleanup.

Reindexing and cache clean are optional steps. Choose inventory_only, full reindexing, or a separate indexing process to match the actual inventory integration.

Installation via Composer

Package kowal/reservation-cleaner, module Kowal_ReservationCleaner. After configuring access to the Kowal repository, install the package, enable the module, update Magento, and clear the cache. In production, include compilation and static content deployment according to your store process.

From configuration to result

1. Define the synchronization model
Confirm when ERP provides the correct stock levels.

2. Check the scope
Select stocks and review the Log Only or Dry Run result.

3. Run the process
The schedule or CLI performs cleanup and optional reindexing.

Controlled stage after ERP import

ERP has completed the stock level import. The integration starts the CLI process for the defined stock scope, and the result is written to the log.

The clean_after_erp_sync mode does not detect import completion on its own. The order of stages is ensured by the schedule or ERP integration.

Match reservations to your inventory model

Want to tailor the module to your store? Ask about Kowal Reservation Cleaner implementation and discuss configuration or the extensions you need.

More Information

Theme compatibility Luma / Blank, KOWAL

Questions and Answers

What does the Magento inventory reservation cleaner remove?

The module is used to automatically or manually clean the `inventory_reservation` table in Magento 2. It is intended mainly for stores where inventory levels are synchronized with an ERP or WMS, and Magento is not the primary source of truth for availability

Does the module disable MSI in Magento 2?

No. The module does not uninstall MSI and does not interfere with the Magento core. Its purpose is solely to manage entries in `inventory_reservation` in a controlled way, in order to reduce issues with availability and `salable quantity` in an ERP-first model.

Can reservations be cleared only for selected stocks?

Yes. The module allows you to specify specific stocks to clear. If the stock list remains empty, the module clears the entire table. If you specify selected stocks, only reservations for the specified `stock_id` are removed.

How can the module be run?

The module can be run automatically from Magento CRON or manually from the CLI. This allows it to operate according to a schedule from the admin panel or be triggered directly after an ERP import by an external integration process.

Is the module suitable for every Magento store?

No. This is a specialized solution for ERP-first implementations. If Magento manages inventory levels independently and the full MSI logic is to remain the key mechanism for availability control, this type of module may not be the right choice. It is worth evaluating the business model and inventory synchronization architecture first.

Change Log

Changelog: Adds CRON-driven and CLI-triggered reservation cleanup with full_reset, log_only, and clean_after_erp_sync modes. Includes process lock, optional reindex and cache clean, technical logging, and stock_id based selective cleanup support.

Module Installation Instructions

Installation via Composer

You will receive access credentials for the Composer repository, the customer email address and license token, by email after purchase. They are also available in the customer panel after logging in at kowal.store. Replace TWOJ_EMAIL_KLIENTA with your account email address and TWOJ_TOKEN with the token you received. Run the commands in the Magento root directory.

composer config repositories.kowal composer https://repo.kowal.storecomposer config http-basic.repo.kowal.store 'TWOJ_EMAIL_KLIENTA' 'TWOJ_TOKEN'composer require kowal/reservation-cleaner

Completing the installation

After installing the package, update Magento and clear the cache:

php bin/magento setup:upgradephp bin/magento cache:flush

In a production environment, also run DI compilation and deploy static files according to your store deployment process.

Press to skip carousel

We found other products you might like!

Write Your Own Review
You're reviewing: Inventory Reservation Cleaner for Magento 2
Your Rating:
Quality
Price
Support
loader
Loading...

You submitted your review for moderation.

Related Posts

Magento 2 says out of stock when stock is available. How to trace salable quantity

Magento 2 says out of stock when stock is available. How to trace salable quantity

2 min read 1 view

Follow one SKU from warehouse shelf to order and shipment. See how sources, reservations and the website stock affect what a Magento shopper can buy.

Read more
Update cookie preferences