Logo Wyomind Magento workshop

Add-ons for Magento®

Mass Stock Update allows you to update manually or automatically all Magento stocks attributes in one go through any CSV or XML files available from the Magento's file system or any remote server through HTTP or FTP.

  • Lifetime Upgrade
  • 6 Months Support
  • 30 Days Money-Back
12 Reviews

Mass Stock Update allows you to update all your product stocks in Magento in no time thanks to CSV and XML files available from your website's server, from remote servers through FTP or HTTP.

How to configure Mass Stock Update

To use Mass Stock Update, you have to go in:
SystemConfigurationWyominDMass Stock Update

Configure Mass Stock Update in a general way

Email reporting

Mass Stock Update includes a reporting tool that notifies you each time a cron task runs, and so if any error happens.

For more details about the cron tasks, look at the below section:
Configure the cron tasks in a profile

Enable reporting

Allows you to define whether you want to enable the reporting or not.

Send the reports to

Allows you to specify the email addresses to which the report must be sent.

For several email addresses, you must use the comma as separator.

Report title

Allows you to define the title of the emails sent by the reporting tool.

List ignored products in the report

You have the possibility to list the ignored products in the report. 


Mass Stock Update also includes a log file that you can enable. 

Enable log file

Allows you to activate the log file available under the var/log directory.

The file is named Wyomind_MassStockUpdate.log.
The log file will be written only if the primary log file is active in:
System Configuration Advanced  Developer  Logs settings

Create an update profile in Mass Stock Update

To update all your stocks in Magento you can update or create a new profile by clicking on Create a new profile  from:
SystemImport/ExportMass Stock Update

Black box

The black-box is a tool that will help you configure your mapping seamlessly. It is composed of 3 major features. 

Input Data Preview

To get a preview of the input data, click on Input data 

Output Data Preview

Clicking on Output data  will give you a preview of the data as they'll be updated. 


The library allows you to check what values you can use for each attribute.  

You will also find some examples to help you. 


In this section, you will be able to define the source of the data.

Profile Settings 

  • Profile name: 
    Only alphabetic and numbers are allowed + hyphens (-) and underscores (_).
    Profile's name must be unique.
  • SQL mode:
    Note that when SQL mode is enabled, data are not updated and a SQL file is generated.

If you activate SQL mode, you'll need to fill in several fields:

  • SQL file path: 
    is where the SQL file will be generated (relative to Magento root folder).
  • SQL file name: 
    is the name of the SQL file to generate.

File Location

This section allows you to specify where the source data file is stored. You have many options:

  • Magento File System
    The file is stored in the Magento root directory or a subdirectory of the Magento root directory.
  • FTP server
    The file is stored on a remote server available from FTP or SFTP
  • Url
    The file is stored on a remote server available from HTTP or HTTPS.
    If you're using the authentication, add the login and password directly in the corresponding fields.
  • Dropbox
    The file is stored in a dropbox. You can generate your token from your Dropbox account https://www.dropbox.com/developers/apps
  • Webservice
    The file can be stored in any web services.

Note you can drag and drop files from your desktop. Only TXT, CSV or XML files are allowed.

File Type

Allows you to specify the file type used for the update, XML or CSV.
  • File type
    You have the choice between CSV and XML files.

For CSV files: 

  • Field separator
    Define the field separator.
  • Field enclosure
    Select the field enclosure. 

For XML files:

  • Xpath to products
    In case of an update from an XML file, fill in the XPath that targets the products. The Xpath is case sensitive.

    File sample
             <name>Product A</name>
             <name>Product B</name>
    The XPath that targets the products in the above file is /Import/PRODUCTS/product

  • XML structure
    You have two options; the Automatic detection or the Predefined structure. The automatic detection fits for simple files made of only one nesting level such as the above file sample.
  • Predefined structure
    If you've selected the Predefined structure, you have the possibility to define your own file structure. When the structure of your file is quite complex, the info may be dispatched in deep nodes and sometimes in tag attributes such as url="something". 

    Below is an example of complex file where you need a predefined structure:
            <qty value="150"/>
                <option name="backorders">2</option>
                <option name="minimal_in_cart">10</option>
    The XPath that targets the products in the above file is /products/item
    The JSON syntax you need to use is:


  • Use a valid Json string made of a key/value list that define the column names and the Xpath associated to the columns.
  • Use @ to access the attribute values. For example: @price.
  • Use [@attribute=value] to access a node from which the attribute is value. For example: [@name='ean'].
  • Use [number] to access another node that has the same name. For example: category.

You can then click Input data from the blackbox to see your source file. 

Post Process Action

You have the possibility to define an action after the file is processed, between:

  • Do nothing
  • Delete the import file
  • Move the import file
    You need to define the file path where you want to move the import file, relative to your Magento root folder.

Advanced Settings

System Settings

  • The first line is a header
    For CSV files, you need to specify when the first line is a header.
  • Filter lines
    Leave empty to export all lines:
    means all lines will be imported

    Type the numbers of the lines you want to import, making sure to separate each line or range with a comma (,):
    e.g: 2,4,6,8,10 
    means lines 2,4,6,8,10 will be imported

    Use a dash (-) to denote a range of lines:

    e.g: 8-10
    means lines 8,9,10 will be imported

    Use a plus (+) to import all lines from a line number:
    e.g: 4+
    means all lines from line 4 will be imported

Note you can combine all those options. For example 2,6-10,15+ means line 2,6,7,8,9,10,15,16,17,... will be imported.

Stock Settings

Automatic stock status update
You can choose to automatically update the stock status (in stock / out of stock).

Mapping & Rules

In this section you can map each column of the file with one of the stock attributes.

Column Mapping

Each column can be mapped with one of the stock attributes. Note that at any time, you can preview the input and output data in the black box directly.
  • Target Attribute 
    Select the target attribute from the ones available in your system (the first line is where you define the identifier of your products). You can find all the attributes grouped by type in our documentation.
  • Data source
    In the Data source, you can define the attribute source that matches with the target attribute from your source file.
  • Custom value
    Sometimes, some columns can be missing. For example, when updating all stocks, the file does not necessarily include all stock attributes (backorders, minimum quantity in the cart...). In that case, you can choose custom value in the Data source and apply a default value.


  1. Add as many columns as you want by clicking on . In many cases, the update file may contain more columns than necessary; you don't need to add these columns and match them. 
  2. Delete  a row easily.
  3. Change the order of each row using the drag and drop.
  4. Deactivate a line while conserving the settings by clicking on the link  symbol.
  5. Add your own custom script </> .  These scripts can be previewed in the output. Check How to use the API
    Note that when there is a script filled in </>  is underlined.
  6. Apply the color of your choice to the row.
  7. Apply a label to the row.
  8. Preview your file by clicking INPut Data .
  9. Find all the attributes grouped by type in the Library .
  10. Check the data as they'll be updated by clicking Output Data .

Scheduled tasks

You can schedule the profile to be executed each day of the week and with an interval of 30 minutes (by default) between each execution.

You can change the cron task interval from:
SystemConfigurationWyomindMass Stock UpdateSettings

For good working scheduled tasks in Mass Stock Update, the main cron task in Magento must be configured properly.

Run a Mass Stock Update profile

You have several ways to run your profiles. 

From the profiles grid

To run the profile from the grid, you just need to click on RUN Profile  in the action menu on the right column. Then the status will be updated with a progress bar.

From the profile page

Open the profile by clicking on the edit option in the action menu in the right column of the profile, and then click on RUN Profile NOW . Once the update process has ended, a message appears with details about how many products have been updated and how many products have been ignored. 


With the cron tasks

When the scheduled tasks are configured for the profile, then the profile will be automatically run at the day and the time selected.

For a good working of the scheduled tasks in Mass Stock Update, the main cron task in Magento must be configured properly.

Look at the official Magento user guide for more details about how to configure the cron tasks in Magento: 

You will receive an email each time the cron task is run if you have enabled the reporting in:
 system configuration Mass Stock Update

To configure the reporting, have a look to: Email reporting

With the Command Lines Interface

Mass Stock Update includes command lines available from the terminal.

php -f shell/wyomind_massstockupdate.php -- [options]

The parameters to use are:

  • -h 
    Short alias for help
  • --run id1,id2,...,idN 
    Generate profile from the given list
  • --sql  id1,id2,...,idN   
    Execute the sql file generated by the profile from the given list
  • --list
    List all profiles

SQL option usage

Updating stocks massively may keep your server busy for a while, especially when the update includes lot of data.

For better performances Mass Stock Update splits the process into two distinct steps:

  1. Source file analysis: the data are collected and the SQL queries for the update are built. 
  2. The SQL file execution: the database is updated with the new data. This step may be executed asynchronously when SQL mode is enabled.

Generate the SQL file

If you prefer to generate the SQL file without executing it, you must enable the SQL mode in your profile configuration. 

Then run the profile by clicking on RUN Profile NOW 

Execute the SQL file

Once the file is generated in the working directory (see Settings), you only need to update the database with the generated file from the command line as follows: 

mysql -h host -p DbPassword -u DbLogin DatabaseName < path/to/mysql/file.sql

You can also use the command line: 

php -f shell/wyomind_massstockupdate.php --sql id1

Advanced Use

The event "mass_update_success" is triggered when the profile is run and the data successfully updated or imported. 

The event is dispatched when the profile is successfully run and can be used in your custom observers. The parameter given in the observer is the running profile.

Event dispatch:

Mage::dispatchEvent("mass_update_success", array("profile" => $this));

Example of use in an observer:

class Editor_Module_Model_Observer
* @param $observer
public function execute($observer)
return var_dump($observer->getProfile()->getData());

Attribute specifications

Stock attributes

All these attributes must be updated with numeric values or boolean values.

  • Multi-stock enabled (Advanced Inventory only, boolean) 
  • Qty (float or integer)
  • Min Qty (float or integer)
  • Use Config Min Qty (boolean)
  • Is Qty Decimal (boolean)
  • Backorders (integer)
  • Use Config Backorders (boolean)
  • Min Sale Qty (float or integer)
  • Use Config Min Sale Qty (boolean)
  • Max Sale Qty (float or integer)
  • Use Config Max Sale Qty (boolean)
  • Is In Stock (boolean)
  • Notify Stock Qty (boolean)
  • Use Config Notify Stock Qty (boolean)
  • Manage Stock (boolean)
  • Use Config Manage Stock (boolean)
  • Stock Status Changed Automatically (boolean)
  • Use Config Qty Increments (boolean)
  • Qty Increments (float or integer)
  • Use Config Enable Qty Increments (boolean)
  • Enable Qty Increments (boolean)
  • Is Divided into Multiple Boxes for Shipping (boolean)

Boolean values

Boolean values must be updated with one of the below values.
  • 1 / 0
  • yes / no
  • true / false
  • enable / disable
  • enabled / disabled
  • in stock / out of stock

Numeric values

 Numeric values must be updated with one of the below types:
  • Integer number (no white space)
  • Float number (decimal separated by a dot)

If the values are misformatted in the update source file, then you must use your own custom script.

Advanced Inventory attributes

All attributes related to the stock management in Advanced Inventory are available in this section.
All these attributes must be updated with numeric values or boolean values.

  • Warehouse - Qty (float or integer)
  • Warehouse - Manage stock (boolean)
  • Warehouse - Backorders allowed (integer)
  • Warehouse - Use config settings for backorders (boolean)

Boolean values

Boolean values must be updated with one of the below values.
  • 1 / 0
  • yes / no
  • true / false
  • enable / disable
  • enabled / disabled
  • in stock / out of stock

Numeric values

 Numeric values must be updated with one of the below types
  • Integer number (no white space)
  • Float number (decimal separated by a dot)

If the values are misformatted in the update source file, then you must use your own custom script.

PHP API for Mass Stock Update

Mass Stock Update allows you to fully customize and control the data output by using PHP scripts in different ways.

API coding standards 

For each line in the Mapping & Rules tab of your profile, you can add your own custom script based on a PHP syntax.

To add your custom script, click on </> at the end of the line you want to edit. You can then update on the file the value of each column.

Note that the </> button may be hidden by the blackbox. 

Opening and closing tags

Every script must include the opening PHP tag <?php. Note that it is not necessary to use the closing tag. 

 /* Your custom script */
 return $self;

Outputting a value

Any value that you want to output in your profile, must be returned with the return instruction.

$this object

$this->skip() or return false (boolean false)
To ignore the pending line (all the columns of the line).

$this->skipRow() or $this->skip() or return false;
To ignore the pending cell as well as all the following cells.

$this->skipCell() or return true;
To ignore the pending cell.

Variable $cell

You can call any column of the source file using $cell. It is an array that indexes each column numerically (1,2,3,...) and with a key corresponding to the name of the column header ("name","description","price"...).

$cell["name of the column"] or $cell[INDEX]

For example:

return $cell["description"]. " ".$cell["name"]

Note it is better to use associative keys. In that case, if the column order changes in the file, your scripts will still be valid.

Variable $self

to retrieve the current value of the column and manipulate the data:

<?php return $self;

For example:

<?php return strtolower($self);

Examples of use

Below are some examples of use with the PHP API. 

Change the separator

Transform a number with a floating value separated with a dot instead of a comma.

For example:

<?php return number_format(str_replace(",",".",$self),2,".",""); ?>

Change a text to lowercase or capital letters

Change a text in lowercase and add a capital letter as the first letter of each word.

For example:

<?php return ucwords(strtolower($self)); ?>

Retrieve images

Retrieve only one image from a list of images. 

For example:

<?php return array_pop(explode(",",$self)); ?>

Group several columns

Put together several columns to create a description.

For example:

<?php return $self." ".$cell["product_name"].", starting at $".$cell["price"]; ?>

Define the visibility of a product

Define the visibility of a product depending on the type column.

For example:


   case "parent":
      return "Catalog, Search";
      return "Not visible individually";

Map value to other ones

Map values to other ones.

For example:


   return "something else";
else if($self=="foo"){
   return "bar";
   return "default value";