This article explains how to setup the Megaventory module for Magento 2.4 and how it takes advantage of a relatively recent feature called "Multiple Source Inventory".

This is a step by step guide on how to use the integration as a Megaventory user, and the actions you can take on both sides.

Step 1: Use the following guide if you have existing data in Megaventory

The following guide will help you import Megaventory data to Magento 2: I am already using Megaventory and want to start using Magento

Step 2: Configure the plugin and initial synchronization

Now that the products are imported in Magento, we can proceed to setting up the plugin and to the initial synchronization of the integration. This process is again similar to the way it was set up in previous version, the change is at the end of the process the user is presented with a table to choose which megaventory inventory location will synchronize with each magento inventory source.

Configuration Step 1: follow the guide in the above Step 1 (and in particular steps 1 and 2 within that guide) to get your API key and enable the integration with Magento. If you are already a user of Megaventory, go to Profile Icon > My Profile and click on the key icon to generate your API key.

Don't forget to click Update to fully associate the generated API key with your user, otherwise the API key will be lost and the process must be done again.

Configuration Step 2: Go to Megaventory Settings on Magento 2 Administrator Area and enter the following details:

API URL: https://api.megaventory.com/v2017a/json/reply/

API Key: (your api key)

Finally, click the Update button.

You should get the following screen

Configuration Step 3: Shipping, Discount and Supplier Attribute Code, Configure the right column with custom options before running the inital setup

Now that we have established a connection and authenticated with the Megaventory API, we have certain options to customize the integration. Specifically, we can choose

  • the id of Magento (one Megaventory account can integrate with up to 10 installations of Magento),

  • the shipping product SKU (the shipping cost is represented in Megaventory as a Service product, so the shipping product SKU will be used create that Service),

  • the discount product sku (similar to shipping),

  • a supplier attribute code which will be taken into account by Megaventory. The default attribute provided by Magento for that is the "manufacturer" attribute, but can also be a custom attribute (Note: the type of that attribute must be text or dropdown).

Clicking Start will begin the process of the initialization of the Megaventory integration.

Configuration Step 4: Finalizing the setup of the integration and enabling order synchronization:

After the initialization process is finished you are going to be presented with the following screen:

You can choose the locations to export the Magento Stock to Megaventory or [Do Not Sync] to manage the stock manually or to synchronize only a subset of the sources with the locations. Note: the relationship is one-to-one so only one location can be synchronized with one source and vice versa. This is reflected by restricting the choices when a location is already picked for another source.

You can either click on "Export Stock in Megaventory as Inventory Adjustment" to export each source to the desired Megaventory location automatically or "Cancel, I will import manually" to manage the initial stock manually.

After that, by clicking the Finish button you have completed the initial setup.

Now you can enable the Order Synchronization if you are sure that the stock and products are currently in sync (ie the stock levels are shown to be the same in the Megaventory account and the Magento eshop for every product). Clicking on the checkbox you get a prompt if you are sure and by clicking Ok all future orders will be automatically synchronized with Megaventory based on the initial setup options or defaults which can be modified at any time on this Settings page.

Note: Once synchronizing orders has been set to be done automatically, it is recommended to fulfill the orders using Megaventory and not from Magento.

Step 3: Choose the Source Selection Algorithm that suits you better

The Magento 2 multiple source inventory introduces complexity to the Megaventory integration with regards to the way Magento manages order placement and order fulfillment. For best results you need to have the order synchronized and approved to a specific megaventory location based on some criteria. The Source Selection Service that Magento 2 provides can be used to choose the preferred location based on order items and stock availability of each product that is present on the order.

Magento 2 out-of-the-box provides two algorithms:

Source Priority Based: Based on the position a source is in a product relative to others (this position can be easily customized by the Administrator). The only drawback is that this is a static parameter and does not take into account anything other than the product being in stock in that location.

Source Distance Based: Based on the distance of the recipient and each individual location. The drawback here is that this needs a complicated configuration and access to Google Maps API for this to work properly.

Those are the known algorithms and can be selected to synchronize the orders. Additional customized algorithms may exist but they might require the Megaventory integration to be customized to work.

Using the below dropdown menu and clicking the Save button you can modify the algorithm to pick a preferred location.

This is on the inventory locations section of Megaventory settings.

Managing Magento Inventory Source/Megaventory Inventory Location Associations

Assigning a Magento Inventory Source to a Megaventory Location or Removing a currently assigned Magento Inventory Source from a Megaventory Location

Below is the section of all the Megaventory Inventory Locations

On the Magento Inventory Source Column you can find the currently associated Magento inventory source to that location.

There are two links if the location has an already assigned source: Assign Source which can be used to change the associated source and Remove Source which can be used to remove the source completely from the Megaventory location.

Clicking Assign Source will provide a dropdown menu to choose the source you want to assign to that location (only the unassigned sources will be available). The screen will become like below:

By clicking Save the changes will be committed and a confirmation message will be displayed on the page. If anything prevents the action to be taken, an error message will appear.

Clicking the Remove Source you will be prompted to confirm the action as below

By clicking Confirm the source will be removed and the page will be reloaded and display a confirmation message, or an error message if there was something wrong which prevented the completion of the action.

This is the overview of the features that are present on the newest version of the Megaventory plugin and the steps to configure it properly, to take advantage of the Multiple inventory feature of Magento.

Order synchronization handling

This new version will be handling the orders automatically based on the assigned sources and based on which source is preferred by the source selection algorithm. The new version will synchronize the order to the location that was assigned based on the inventory source that the algorithm recommended.


You have three inventory locations in Megaventory and three inventory sources on Magento and you have assigned them like this:

Megaventory Locations:

Main Supply Warehouse

Main Wholeshale Store
Main Retail Store

Magento Inventory Sources:
Wholesale store
Retail store

Main Supply Warehouse maps to Warehouse
Main Wholesale Store maps to Wholesale Store

Main Retail Store maps to Retail Store

Now lets say an order that has 3 products is placed on Magento and on the Retail store you have 2 out of 3 products recommended to be dispatched from there. With these associations the Retail store is associated with the Main Retail Store, so the order will be synchronized to the Main Retail Store in Megaventory.

Stock synchronization, stock import and stock export

These procedures are modified to utilize the Multiple inventory source system that Magento provides in 2.4 version onwards. This means that each stock respectively will be synchronized to and from the associated Megaventory location but also the alert quantity can be changed based on the options provided on Magento or vice-versa. This provides a flexible way of working with multiple locations which can automate the inventory management processes.

Where to access the Megaventory plugin functionality

For all options go to the megaventory plugin section which can be reached from the sidebar menu on "Megaventory":

Did this answer your question?