🌐 Language: 🇻🇳 Tiếng Việt · 🇬🇧 English (current)
Product stock management in GP247
Introduction
This document explains the stock management business logic of GP247/S-Cart for non-technical shop owners: when stock goes up or down, the two key settings that decide whether over-stock selling is allowed, and why an order created in the admin panel decrements stock exactly like an order a customer places on the storefront. After reading it you will be confident configuring stock and understanding how the numbers move.
1. The two numbers on every product
Every product has two quantity numbers to remember:
- Stock (
stock): the amount currently available to sell. - Sold (
sold): the amount already sold (statistics only, increases automatically).
There is also a Minimum quantity (minimum): the least a customer must buy in one order (default is 1).
When an order is placed, the system decreases
stockand increasessoldby the same amount. When an order/line item is removed, stock is returned.
2. Stock lifecycle diagram
flowchart TD
A["📦 Product stock"]
A -->|"Create order (storefront OR admin)"| B["stock down · sold up<br/>by the ordered quantity"]
A -->|"Add / increase a line item in admin"| B
B -->|"Delete order · delete line · reduce quantity"| A
A -.->|"Bundle-type product"| C["Decrement EACH component's stock<br/>by its quantity in the bundle"]
If your reader cannot render the diagram, think of it simply: an order decreases stock, removing an order returns it — regardless of where the order was created.
3. The two settings that govern selling against stock
Two switches in Store configuration directly affect stock:
| Setting | Located in | Meaning |
|---|---|---|
Stock management (product_stock) |
Product config | On = the shop tracks stock. Off = stock is ignored — always allow buying. |
Allow buy out of stock (product_buy_out_of_stock) |
Order config | On = customers may buy beyond stock (stock can go negative). Off = block when over stock. |
The system's "enough stock to sell" rule is:
Allow the quantity if ( allow buy out of stock ) OR ( stock is not managed ) OR ( stock ≥ ordered quantity ).
Hierarchy (important):
product_stockis the master switch.product_buy_out_of_stockonly has an effect whenproduct_stockis on. If stock management is off, the "allow buy out of stock" option has no meaning (the system always allows buying). The two switches do not conflict — they combine with OR.
There are also two related (optional) settings:
- Hide out-of-stock products (
product_display_out_of_stock): with stock management on, a product at 0 is hidden from the storefront. - Pre-order (
product_preorder): allow pre-ordering even without stock.
4. When does stock DECREASE, when is it RETURNED?
Stock decreases (stock down, sold up) when:
- A customer successfully places an order on the storefront (checkout completed).
- You create an order in admin (the Create Order screen).
- You add a line item, or increase the quantity of a line item on an admin order.
Stock is returned (stock added back) when:
- Deleting a whole order → returns stock for all of its line items.
- Deleting a single line item on an order.
- Reducing a line item's quantity (only the difference is returned).
Key point: admin-created orders decrement/return stock just like customer orders. Previously admin orders did not touch stock, causing inconsistent figures — this is now unified.
5. How do Bundle products decrement stock?
For a Bundle (Bundle/Build) product, selling 1 bundle decrements the stock of each component by the quantity declared in the bundle (and also the bundle's own stock if it is tracked).
Example: "Gift set" = 1 box of cookies + 2 bottles of water. Selling 1 set → removes 1 box of cookies and 2 bottles of water from stock.
For how to create and configure bundles, see Bundle products (Bundle/Combo) and Product structure.
6. An important difference: storefront hard-blocks, admin warns
When "Allow buy out of stock" is off and the quantity exceeds stock:
- On the storefront (customer buying): the system hard-blocks — an over-stock order cannot be placed. This prevents overselling against real stock.
- In admin (you create/edit an order): the system still saves but shows a warning about over-stock. Reason: the administrator has authority (e.g. sell first, restock later) but still needs to see the warning to avoid mistakes.
In short: customers are blocked, admins are warned. Both honour the same
product_buy_out_of_stocksetting; only the reaction on over-stock differs.
7. Step-by-step configuration (for beginners)
- Log in to the admin panel and open Store configuration.
- Open the Product group and find Stock management (
product_stock):- Turn it on if you want to track stock quantities.
- Turn it off for services / unlimited quantities (always allow buying).
- Open the Order group and find Allow buy out of stock (
product_buy_out_of_stock):- Off to block over-stock selling (recommended for physical goods).
- On to allow buying even when out of stock (stock can go negative).
- Open each Product and enter its Stock (
stock) and Minimum quantity (minimum) if needed. - Save. On success the system reports a successful update and the stock numbers apply immediately on the storefront.
Test tip: create a test order in admin for a product that has stock, then reopen that product to check that
stockdecreased andsoldincreased correctly.
Q&A
Q1: How do I make the shop ignore stock (always allow buying)?
→ Turn off Stock management (product_stock). The system will then always allow buying without checking stock.
Q2: How do I block customers from buying when out of stock?
→ Turn on Stock management and turn off "Allow buy out of stock" (product_buy_out_of_stock). When stock reaches 0, customers can no longer order.
Q3: Why did creating an order in admin not change stock (in the old version)?
→ That was an old bug: admin orders did not decrement stock. The current version is fixed — admin orders decrement/return stock like customer orders.
Q4: In admin I create an over-stock order and it still saves?
→ Correct. Admins get a warning but can still save (you have authority). Customers on the storefront are blocked in the same situation.
Q5: Can stock go negative?
→ Yes, when "Allow buy out of stock" is on, or when an admin deliberately creates an over-stock order. A negative number means you owe stock.
Q6: Does deleting an order return stock automatically?
→ Yes. Deleting a whole order or an individual line item returns the corresponding stock. Reducing a line item's quantity returns only the difference.
Q7: How do Bundle products decrement stock?
→ Selling 1 bundle decrements the stock of each component by its quantity in the bundle. See the Bundle products document.
Q8: How is "Sold" (sold) different from "Stock" (stock)?
→ stock is the amount left to sell; sold is the amount already sold, used only for statistics and increased automatically when orders are placed.
Q9: How do I hide products when out of stock on the storefront?
→ Turn on Hide out-of-stock products (product_display_out_of_stock); with stock management on, a product at 0 will not be shown.
Q10: What is the Minimum quantity (minimum) for?
→ It forces customers to buy at least a certain amount per order (e.g. wholesale minimum of 10). The default is 1.
📅 Last updated: 2026-08-12 · ✍️ Author: GP247