Magento Open Source 2.3.x

About Source Selection Algorithm and Reservations

The heart of Inventory Management tracks every available product virtually and on-hand in your warehouses and stores. The Source Selection Algorithm and Reservations systems run in the background, keeping your salable quantities updated, checkout free of collisions, and shipment options recommended.

Source Selection Algorithm

The Source Selection Algorithm (SSA) analyzes and determines the best match for sources and shipping using the priority order of sources configured in a stock. During order shipment, the algorithm provides a recommended list of sources, available quantities, and amounts to deduct according to the selected algorithm. Inventory Management provides a provides a Priority algorithm and supports extensions for new options.

With multiple source locations, global customers, and carriers with various shipping options and fees, knowing your actual available inventory and finding the best shipment option can be difficult. SSA does the work for you from tracking inventory salable quantities across all sources to calculating and making recommendations for shipments.

Track Inventory: Using stocks and sources, the SSA checks the sales channel of incoming product requests and determines available inventory:

  • Calculates the aggregated virtual salable quantity of all assigned sources per stock: aggregates Quantity - Out-of-Stock Threshold per source
  • Subtracts the Out-of-Stock Threshold amount from salable quantity to protect against overselling and support concurrent checkout
  • Reserves inventory quantities at checkout, deducting from in-stock inventory at order processing and shipment
  • Supports backorders with enhanced options for negative thresholds

Manage Shipments: The algorithm helps when you process and ship orders. You can run the algorithm to get recommendations on the best sources for shipping the product or override the selections to:

  • Ship partial shipments, sending only a few products from specific locations and completing the full order at a later date
  • Ship the entire order from one source
  • Break the shipments across multiple sources in different amounts to keep a balanced stock across all warehouses and stores

SSA is able extensible for third party support and custom algorithms for recommending cost effective shipments.

SSA functions differently for Virtual and Downloadable products, which may not incur shipping costs. In these cases, the system runs the algorithm implicitly when it creates invoices, and always uses the suggested results. You cannot adjust these results for Virtual and Downloadable products.

Priority Algorithm

Inventory Management comes with the SSA Priority algorithm out-of-the-box. The algorithm primarily recommends product deductions per source when invoicing and shipping the order.

This algorithm considers the configured priority set at the stock level when fulfilling orders:

  • Works through the list of sources in order from top to bottom
  • If the source has a virtual aggregated available stock, it recommends deductions and shipments from that source first.
  • Continues down the list until the order shipment is filled.
  • Skips disabled sources if found in the list

Example SSA recommendations for a Mountain Bike

Custom Algorithms

Magento supports custom development and extensions to add alternative algorithms to prioritize sources. For example, you can have one priority algorithm based upon geography and another based upon expense of stock or a customer attributeA characteristic or property of a product; anything that describes a product. Examples of product attributes include color, size, weight, and price.. When the cost of stock changes, your implementation can easily change algorithms to ensure the lowest cost.

Concurrent Checkout

The Concurrent Checkout feature tracks and reserves sales, preventing sales from overselling stock, but only when each source is assigned to one stock. As products are added to cart and checkout completes, Inventory Management enters a reservation against the aggregated product quantity. This protects the inventory through to shipment, ensuring customers correctly receive their ordered products. Reservations clear when the order is invoiced (deducting quantities) or an order is canceled before invoiceA document that provides a detailed description of a purchase, including products purchased, quantity, price, shipping cost, sales tax, and total. and shipment.

This feature, reservations, and the entire process is transparent to customers. They see information on stock quantities as normal through the product page and notifications through checkout.

If you assign each source to only one stock, then you will never run into the situation where you could potentially oversell inventory when multiple users are checking out at the same time. In rare cases, you potentially have issues with overselling when you assign one or more sources to more than one stock. The situation may occur when customers compete for the last remaining stock of a product.


Instead of immediately deducting or adding product inventory quantities, reservations hold inventory updates until order shipment or product refunds. Reservations work entirely in the backend to automatically update inventory totals.

Order reservations

Reservations place holds on inventory quantities for the entire shopping process: adding products to cart, completing checkout, and managing refunds. For available inventory and stock, reservations enter against the aggregated inventory at the stock level. The reservations remain in place, counting against the salable quantity without deducting from the actual inventory quantity.

The reservations are at the stock level, counting against quantities until the order is invoiced and shipped. When shipping the order, you can use the SSA recommendation or override to manually override the deductions per source. The reservations automatically deduct from the product quantity for the selected source(s).

The following diagram helps define the process of reservations during an order and through to shipment.

In the example, a customer adds a product to a cart. Magento checks for available salable quantities for the products for that sales channel through the stock. If enough total inventory is available, a reservation saves that quantity temporarily for the order, deducting it from the salable quantity.

As the order is invoiced, you determine the sources and inventory quantities to deduct and ship. The shipment continues from those sources, sent to the customer. The quantities automatically deduct from the source inventory quantity. For complete details and examples, see About Order Status and Reservations.

Updating Reservations

As changes occur in orders and product amounts, Magento automatically enters. The system only adds reservations, with a positive or negative amount. Initial reservations enter when customers to a cart or admins add products to a new order. When modifying these held amounts, reservation compensations enter.

All reservations need to be cleared by compensations when orders complete fulfillmentThe process of managing customer shipments., products cancel, credit memos are issued, etc. If compensations do not clear out reservations, you may have quantities held in stasis, not available for sale and never shipping.

If you remove all sources from a product for a stock with pending orders, you may have stuck reservations.

Important: Unassigning a source clears all quantity data. Reassigning a source with quantity data can potentially cause issues with pending orders with reservations and affect stock salable quantity counts. Keep in mind, all product quantities in shopping carts and submitted orders have associated reservations. If you unassign the only sources providing those products to the stock, orders cannot be completed and shipped for that sales channel.

Recommendation: We recommend processing all pending orders and sending shipments prior to removing sources or transferring all inventory.