# Stock management in OpenCart: setup, deductions and inventory control

> How stock management works in OpenCart 3.0 and 4.1: quantities for products and options, when stock is deducted, what to show customers and how to avoid selling out-of-stock items.

Джерело: https://opencartcode.com/en/wiki/operations/opencart-inventory-management
Оновлено: 2026-11-26

[Stock tracking](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#stock-tracking) in OpenCart is built in: each product and each [option value](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#option-value) has a quantity field, and the system deducts stock automatically when an order moves to the right status. This is enough for a store with one warehouse. But tracking works correctly only when three things are configured: the fields in the product form, the order statuses that trigger deduction, and storefront behavior when an item is out of stock. Below, each step is covered for OpenCart 3.0 and 4.1, along with common mistakes and the point where built-in features are no longer enough.

Examples are for OpenCart 4.1; in 4.0.x, model triggers and event handling work differently.

## What OpenCart can and cannot do for stock tracking

First, let's assess the capabilities honestly. OpenCart stores one number per product: the `quantity` field in the products table. Quantity is also stored separately for each option value, for example size M or the color "black". Beyond that, OpenCart knows nothing about warehouses: it has no waybills, cost price, reserves, or multiple warehouses. For how this data is structured in the database, see the article on the [product table and related tables](https://opencartcode.com/en/wiki/dev-database/tablicia-product-opencart).

| Task | Built into OpenCart | Comment |
| --- | --- | --- |
| Product quantity | Yes | One number per product |
| Quantity by options (size, color) | Yes | Separate for each option value |
| Automatic deduction on order | Yes | Depends on order status |
| Return to stock on cancellation | Yes | Also through statuses |
| Multiple warehouses, pickup points | No | Requires a module or external system |
| Receipts, waybills, cost price | No | Accounting system or module |
| Reserve for an unpaid order | Partially | Only if the order status already deducts stock |
| "Low stock" report | No | A quantity filter is available in the product list |

In OpenCart 4.1, there are product variants: separate products linked to a master product, each with its own stock. For these, stock is tracked like regular products, not like options.

## How to set up stock in the product form

Open "Catalog → Products", then the product, and go to the "Data" tab. The stock fields are in the quantity block.

Data tab in the product form: quantity, minimum quantity, subtract stock, and out-of-stock status · OpenCart 4.1.0.4

1. **Quantity:** the actual stock that can be sold. Don't enter a "buffer" here or set 999 "so it never runs out", because that makes tracking meaningless.
2. **[Minimum Quantity](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#minimum-quantity):** the number of units the customer must add to the cart. For single items, leave it at 1. Higher values are used for wholesale items or products sold in packs.
3. **Subtract Stock:** "Yes" means OpenCart deducts the quantity when an order is placed. "No" is set for services, digital products, and made-to-order items where stock doesn't matter.
4. **Out Of Stock Status:** the text the customer sees when stock is zero: "Out Of Stock", "2-3 Days", "Pre-Order". The status list is edited in "System → Localisation → Stock Statuses".
5. **Date Available:** the date from which the product is available. It's useful if you add new arrivals in advance.

### Stock by options

If a T-shirt is sold in sizes S–XL, the total quantity on the "Data" tab and the quantities for sizes on the "Option" tab are two independent counters. When an order is placed, OpenCart deducts both: from the product and from the selected option value, if subtraction is enabled for both. So the total quantity must equal the sum across sizes. Otherwise, the storefront will show "In Stock" even when the needed size is gone, or the reverse.

Option tab: each option value has its own quantity field and subtraction toggle · OpenCart 4.1.0.4

> If an option value has zero stock and subtraction is enabled, OpenCart warns the customer in the cart, just as it does for a product. Without this, a customer could happily order a size that has been gone for a long time.

## When exactly OpenCart deducts stock

This is the main source of errors. OpenCart does not deduct stock at the moment the "Confirm Order" button is clicked. Deduction happens when an order *first* receives a status from the "processing" or "complete" lists. If an order moves from these statuses to any other, for example "Canceled", the stock is returned. The logic is built into the order history change function. For developers, the article on [addOrderHistory and changing order status](https://opencartcode.com/en/wiki/dev-flows/addorderhistory-opencart) covers this in detail.

Status lists are configured in "System → Settings", on the "Option" tab, in the checkout block: "Processing [Order Status](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#order-status)" and "Complete Order Status". The default status for new orders is also set there.

Option tab in settings: processing and complete order statuses that control stock deduction · OpenCart 4.1.0.4

In practice, this means:

- **The status of a new order must be in the "processing" list.** Otherwise, stock isn't reserved between checkout and manual confirmation, and two customers can buy the last unit.
- **"Lost" orders deduct nothing.** If a customer goes to the payment page and never returns, the order has status 0 and doesn't appear in the regular list. This is correct for stock, but the manager won't know about that sale.
- **Cancellation returns stock only if the "Canceled" status isn't marked as "processing".** A common mistake is ticking all statuses in both lists "just in case", after which canceled orders permanently eat up stock.
- **Returns don't restock automatically.** Goods returned by a customer must be added to the quantity manually.
- **Editing an order in the admin** recalculates products. After changing stock on an order, check the product's stock in the product form.

If a payment service confirms payment but the status doesn't change, stock won't be deducted either. The causes are covered in the article [why the order status doesn't change after payment](https://opencartcode.com/en/wiki/payments/order-status-not-updating-after-payment).

## What to show customers when a product is out of stock

Storefront behavior is controlled by three toggles on the same "Option" tab in the store settings:

- **Display Stock:** instead of "In Stock", the customer sees the exact number. For scarce items, this encourages purchase. But if tracking is inaccurate, customers get annoyed when "5 pcs." turns out not to be true.
- **Show Out Of Stock Warning:** the cart flags items that aren't available in the required quantity.
- **Stock Checkout:** allows checkout even when there is no stock. If this toggle is on, quantity goes negative and out-of-stock items get sold.

The choice between "allow" and "forbid" depends on the business model. A store with its own warehouse usually forbids checkout: it's better to lose an order than to call the customer with apologies. A store that works with suppliers and gets goods in 1–3 days allows checkout, but sets the "Pre-Order" out-of-stock status and honestly states the lead times in the product listing. For how to present availability and timelines in a way that sells, see the article on [a product page that sells](https://opencartcode.com/en/wiki/catalog/online-store-product-card).

> Don't disable or delete products that are out of stock. The page with traffic and search positions will disappear, along with the customers who would have come back when the item was restocked. Keep the page with the "Out Of Stock" status and suggest similar products.

## How to check stock daily and avoid selling what you don't have

Even a perfectly configured system drifts from the shelf: breakage, mispicks, sales offline or on a marketplace, errors in returns. That's why a simple, regular routine is needed.

### Daily: a list of products with zero and negative stock

The "Catalog → Products" list has a quantity filter and sorting by the quantity column. Sort ascending, and at the top of the list you'll see items that are sold out or have gone negative. A negative number means the product was sold but isn't in the warehouse. Handle such orders first.

Product list: quantity filter and sorting to quickly find zero and negative stock · OpenCart 4.1.0.4

Options aren't visible in this list. To review stock by size and color, it's more convenient to run a query in phpMyAdmin (if needed, replace the prefix `oc_` with yours):

```sql
SELECT p.product_id, pd.name, od.name AS option_value, pov.quantity
FROM oc_product_option_value pov
JOIN oc_product p ON p.product_id = pov.product_id
JOIN oc_product_description pd ON pd.product_id = p.product_id AND pd.language_id = 1
JOIN oc_option_value_description od ON od.option_value_id = pov.option_value_id AND od.language_id = 1
WHERE pov.subtract = 1 AND pov.quantity <= 0 AND p.status = 1
ORDER BY pov.quantity ASC;
```

The query works the same way in 3.0 and 4.1, because these tables have the same structure in both branches. `language_id = 1` is the ID of the language installed first (usually English). Find the language ID in "System → Localisation → Languages" and substitute it in the query.

### Monthly: partial stock count

There's no need to recount the entire warehouse every month. It's enough to review the 20–50 best-selling items and those with returns. Fix discrepancies in the product form and record the reason. This way, you'll see where goods are actually being lost: in packing, during returns, or in sales made outside the website.

### Who has the right to change quantities

If three managers are correcting quantities, you won't find the causes of discrepancies. Limit editing of products to one person or group in "System → Users → User Groups", and restrict order access as well. For how to fit the warehouse into the general order workflow, see the article on [order processing from request to delivery](https://opencartcode.com/en/wiki/operations/order-processing-workflow).

## When built-in stock tracking is not enough and what to do

Built-in tracking stops coping in several typical situations:

- **Sales across several channels.** You sell on the website, on a marketplace, and in a physical store, but there's only one stock figure. Without synchronization, the marketplace will sell what has already been bought on the website. Options for combining channels are covered in the article on [marketplaces and your own website](https://opencartcode.com/en/wiki/marketplaces/marketplaces-and-your-own-website).
- **Goods from a supplier.** Availability must be updated regularly from a price list, and doing this by hand is impossible once you have several hundred items. You'll need a scheduled import. The technical side is explained in the article on [a product import script without duplicates](https://opencartcode.com/en/wiki/dev-api/opencart-product-import-script).
- **An accounting system.** If accounting and the warehouse are kept in an external system, it's better to treat that system as the main source of stock, and OpenCart as the storefront to which stock is exported. Two-way editing of quantities almost always ends in discrepancies.
- **Bundles.** A "laptop + bag + mouse" set should deduct three separate products, not one "bundle" with an invented stock figure. Standard OpenCart can't do this. This task is handled, for example, by the [KomplektyPro](https://opencartcode.com/en/marketplace/product/komplektypro) module.
- **Cost price and profit.** A piece count won't show how much money is tied up in the warehouse or which products are sold at a loss. For this, you need management accounting: external spreadsheets, an accounting system, or a module such as [Profit — management accounting for OpenCart stores](https://opencartcode.com/en/marketplace/product/profit-upravlinskii-oblik-dlia-opencart-magazinu). The article on [order unit economics](https://opencartcode.com/en/wiki/economics/unit-economics-for-ecommerce) will help you decide what to calculate first.

The key rule for any integration: every stock figure must have one source of truth. If the quantity is updated simultaneously by an import, a manager, and a marketplace, it's impossible to determine which number is correct.

## Summary

- OpenCart 3.0 and 4.1 track stock for products, option values, and (in 4.1) variants, but have no warehouses, waybills, or cost price.
- A product is deducted when an order receives a status from the "processing" or "complete" lists, and is returned when the order leaves them. Configure these lists deliberately and don't mark "Canceled" in them.
- The total product quantity must equal the sum of option stock.
- Decide whether to allow checkout when out of stock, and align this with the out-of-stock status and the lead times on the [product page](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#product-page).
- Check zero and negative stock daily, do a partial stock count monthly, and restrict who can change quantities.
- For multiple channels, suppliers, and bundles, define one source of truth and automate updates.

The next step is to run through the setup in this article on a test order: place it, change its status, cancel it, and check how the quantity changes. Other topics on stock, suppliers, and order handling are collected in the section ["Orders, Stock, and Operations"](https://opencartcode.com/en/wiki/operations).

## FAQ

**Why didn't the stock decrease after a new order?**

Most often, the new order status is not in the "processing" list in the settings, or "Subtract Stock" is turned off for the product. Also check whether the order got stuck because payment was not completed.

**How do you bulk update quantities for hundreds of products?**

Through an import from a spreadsheet or price list: with a ready-made import module or a custom script that updates quantities by SKU. Editing manually in the admin is slow at this volume and error-prone.

**Can you hide out-of-stock products from the catalog?**

There is no standard toggle for this, so you need a module or a change to the catalog query. For SEO, it's usually better to keep such products visible with an out-of-stock status.

**What happens if two customers buy the last unit at the same time?**

If checkout with no stock is disabled and the new order status deducts stock, the second customer will get a warning. Otherwise, both orders go through and the stock goes negative.

**Does the product return to stock if you delete the order?**

Don't delete orders to adjust stock. It's better to set the order to the "Canceled" status, which is not in the "processing" or "complete" lists. OpenCart will then return the quantity automatically.
