View Categories

Stock Update Fails with Decimal Quantities

Table of Contents

Problem Description #

When an order sells part of stock using decimal quantities (e.g. 0.5, 0.2) and the remaining stock drops below 1 unit, updating the stock fails , plugin (or WooCommerce) shows a “stock not updated” error.

Common Symptoms:

  • In admin product edit screen, attempting to update stock after a decimal‑quantity order leads to error: “The stock has not been updated because the value has changed since editing.” WordPress.org+1

  • Store shows incorrect or zero stock despite there being fractional quantity remaining.

Cause:

  • WooCommerce core expects integer stock quantities; decimal stock levels may not be supported fully , causing inconsistencies when saving stock after fractional sales. WordPress.org+1

  • Min Max plugin allows decimal quantities, but stock adjustment logic cannot reconcile fractional stock levels with integer-based stock fields.

Solution (step-by-step)

  1. Avoid using decimal stock management , if possible, adjust unit measurement so that stock is always in integer units (e.g. grams instead of kilograms, so 0.5 kg = 500 g).

  2. If decimals are necessary, track stock manually outside WooCommerce stock fields , e.g. use custom meta or external inventory system.

  3. After sale with decimal quantity, do not rely on WooCommerce stock auto‑update , manually adjust stock or round to nearest unit.

  4. Inform warehouse/inventory staff about possible discrepancies , avoid overselling based on fractional stock.

  5. Monitor plugin updates , plugin authors may release improved stock-handling for decimal quantities; test on staging before applying.

Prerequisites

  • Awareness that WooCommerce core doesn’t natively support fractional stock.

  • Either accept limitations or use alternate unit conventions (e.g., smallest unit as integer).

Additional Notes

  • Selling by weight or volume often requires custom stock logic; decimal quantity plugins may help with order-level quantity, but inventory tracking typically needs custom handling.

  • Consider integrating with dedicated inventory management systems if fractional stock is central to your store.

 

Min Max Default Quantity for WooCommerce