Stock and orders
How the stock of each combination is checked in the cart, subtracted when an order is placed and returned when it is cancelled, and how orders keep the combination.
Two stock figures
A product with combinations has two quantities:
- the Quantity of each combination, which is the real stock of that variant;
- the main Quantity of the product, which OpenCart uses in its own lists and reports.
When you save the product, its main quantity is set to the sum of the quantities of its combinations. From then on both figures are reduced by orders, each according to its own Subtract Stock setting: the one of the combination in the combinations editor, and the one of the product in its Data tab.
Checks when adding to the cart
When the customer adds a product with combinations to the cart, the extension checks in this order:
- A combination must be selected. If not, the message of Text Select combination message is shown.
- The selection must match an existing combination of the product. If not, the same message is shown.
- If the combination has Subtract Stock set to Yes, the units requested plus the units of the same combination already in the cart cannot be more than its Quantity. If they are, the message of Text unavailable quantity is shown, for example "Can't add 6 unit(s) to cart, only 5 available."
The third check is skipped when your shop allows buying without stock, that is, when Stock Checkout is set to Yes in System > Settings > your store > Option.
Combinations with Subtract Stock set to No are never limited by their quantity.
In the cart and at checkout
If a combination with Subtract Stock set to Yes has fewer units than the cart asks for, OpenCart marks the product as not in stock in the cart, exactly as it does for a standard product. Whether the customer can still check out depends on your Stock Checkout setting.
When an order is placed
The order stores which combination was bought for each product line.
At the moment OpenCart subtracts stock for the order:
- the main quantity of the product is reduced as usual, if the product has Subtract Stock set to Yes;
- the quantity of the combination is reduced by the units ordered, if the combination has Subtract Stock set to Yes.
When OpenCart returns the stock of an order, for example because the order is cancelled, the quantity of the combination is increased again by the same units.
Keep stock at zero
With Keep stock at zero disabled, an order for more units than available leaves a negative quantity, which shows you how many units you owe. This happens mainly when your shop allows checkout without stock.
With Keep stock at zero enabled in the General settings, neither the combination nor the product goes below zero.
Order again
When a customer uses the reorder button in their account, the product is added to the cart with the same combination as in the original order.
Orders in the administration
When you create or edit an order in Sales > Orders and add a product that has combinations, the product form of the order shows the chained options of the product. Choose the values of the combination before pressing the add button. The order then stores the combination and its stock is handled as in a shop order.
Existing order lines keep their combination when you edit the order.
Checkout extensions
Orders placed through the standard OpenCart checkout keep the combination, and the Journal compatibility packages cover the Journal checkout. If you use another checkout extension, place a test order and confirm that the stock of the combination goes down. If it does not, open a ticket in your account.
Still need help?
Open a support ticket from your account and our team will look at your store with you.