
Recently, the concept of
Omnichannel has become popular, when in order to improve the quality of customer service, various sales channels are integrated into one. And no matter how and where the sale is made, it makes sense for the seller to combine all sales channels in order to fulfill the order. In practice, this means that it does not matter if the client came to you offline, made an order on the website, in a mobile application or by phone - you must use all available means to carry it out. And for you, as for the seller, each individual channel should not be a big difference.
Presentation of the omni channel on the example of Frankfurt Airport (Eng.).
For the integration described above, it is very important for the seller to integrate the inventory levels of the goods. Because retail infrastructure can be quite complex and combine external warehouses, shops, stores with the ability to order goods to the store (store pick-up),
dropshipping (the trade scheme in which you sell products from the supplier’s company, which itself sends them to the buyer from Your name, and you only accept money from the buyer).
')

Since we are developing a framework, and not a specific solution with turnkey integration for a particular business, the set of requirements for us has turned out to be quite broad.
The main requirements include:
- The inventory management system should not be a bottleneck during a checkout when an order is placed. Those. there should be no synchronous checks on the relevance of the availability of products at each of the warehouses, and potential interlocks associated with them.
- The system must support asynchronous order processing, in which the creation of an order will not be an operation changing the state of the system. And it will only register the command that will need to be processed later. Thus, the time-critical order placement operation will be very fast and without any locks. Such an implementation can be seen, for example, at Amazon, when, after successfully placing an order and paying the buyer, a letter may arrive in time stating that the system cannot fulfill the order, because the goods in the warehouse are not enough and return money. On the one hand, this may worsen the impressions of the buyer, but for sellers with large warehouses who make hundreds of thousands of sales per day - such a risk is quite justified in order to speed up the process of placing an order.
- The system should provide various algorithms for the delivery of goods from several warehouses to the end user. For example, in the simplest case, it can be a priority delivery, where each of the sources of delivery is given a priority, and the system will follow this priority trying to take the maximum amount of goods to fulfill orders from each warehouse. More elephant algorithms involve the determination of the minimum shipping costs (Minimal Shipping Cost) separately for the customer and for the seller.
- The inventory management system should provide the value of a certain aggregate flow for a particular product within the current context, on the front end for buyers. And this value is taken into account when selling goods or when evaluating whether we have finished the availability of goods or not yet. This is necessary in order not to count runoff for each of the products in runtime, especially on such critical pages as starnitsa category of products, this can take sufficient time and slow down productivity.
- The system must support the reservation mechanism when the seller can reserve a sale, for example, for his wholesale customer, which must be completed within a certain period. After that, the reserved products cannot be sold through other sales channels to other customers.
- The system should provide a mechanism for controlling the workload of warehouses and other physical locations for the placement of goods. To be able to plan and organize logistics and delivery of goods, when stocks need to be replenished.
- To support the previous item, a special set of states for the product must also be entered in order to solve such problems: the goods are sold but not yet shipped from the warehouse, respectively, still occupies a place in the warehouse, and we cannot import new goods to this warehouse. Also, the goods that were returned by the buyer can not always immediately return to stock. Sometimes the goods are returned due to the principle of malfunction or defect, respectively, such goods should be processed separately.
- Dropshipping support
- The system should prevent the flexible possibility of mapping physical stores to sales channels (Sales Channel). About this item separately
Mapping of physical warehouses and warehouses to sales channels

This chart shows the various possibilities of mapping physical stores where goods are located on sales channels. Under the sales channels refers to the delivery of goods to the market and their subsequent implementation. For example, in terms of Magento, this could be a Website, but with the advent of B2B a separate sales channel may be a wholesale customer for whom you have a separate discount and who can bargain with you separately. In this case, the sales channel will be the Customer Group. Also a good example of a sales channel may be a country or region.
As you can see in this diagram, physical warehouses are combined into a virtual aggregation, which in turn is assigned to a specific distribution channel. In this case, one physical warehouse can serve more than 1 sales channel, and within the sales channel, stock from more than one warehouse can be combined. This allows you to achieve maximum flexibility, as well as, if necessary, introduce new sales channels and compare existing drains with them.
Magento MSI (Multi Source Inventory)
This article is the first article in the “Warehouse Management System Using CQRS and Event Sourcing” cycle within which the collection of requirements, design and development of a warehouse management system will be considered using Magento 2 as an example.
An open project, where development is underway, and where community engineers are involved, as well as where you can familiarize yourself with the current state of the project and documentation, is available at
github.com/magento-engcom/magento2/projects