Magento Commerce, 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
  • Reserves inventory quantities on order submission, 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.

Source Priority Algorithm

Custom stocks include an assigned list of sources to sell and ship available product inventory through your storefront. The Source Priority algorithm uses the order of assigned sources in the stock to recommend product deductions per source when invoicing and shipping the order.

When run, the algorithm:

  • Works through the configured order of sources at the stock level starting at the top
  • Recommends a quantity to ship and source per product based on the order in the list, available quantity, and quantity ordered
  • Continues down the list until the order shipment is filled
  • Skips disabled sources if found in the list

To configure, assign and order sources to a custom stock. See Prioritizing Sources for a Stock.

The following example details the mapped sources in order, available quantity, and recommended source and amount to deduct and ship. The top source is a Drop Shipper in the United Kingdom with an available quantity of 240.

Example SSA recommendations for a Mountain Bike

Distance Priority Algorithm

The Distance Priority algorithm compares the location of the shipping destination address with source locations to determine the closest source to fulfill shipments. The distance may be determined by physical distance or time spent traveling from one location to another, using imported database locations or Google directions (driving, walking, or bicycling).

You have two options for calculating the distance and time to find the closest source for shipment fulfillmentThe process of managing customer shipments.:

To configure, select configurations and complete additional steps such as the Google API key or downloading shipping data. See Configuring Distance Priority Algorithm.

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.


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 fulfillment, 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.