header

Magento 1.x Software Support Notice

For Magento Commerce 1, Magento is providing software support through June 2020. Depending on your Magento Commerce 1 version, software support may include both quality fixes and security patches. Please review our Magento Software Lifecycle Policy to see how your version of Magento Commerce 1 is supported.

For Magento Open Source 1.5 to 1.9, Magento is providing software security patches through June 2020 to ensure those sites remain secure and compliant. Visit our information page for more details about our software maintenance policy and other considerations for your business.

Catalog Inventory

Edit this page on GitHub

Module: Mage_CatalogInventory

The Mage_CatalogInventory module allows you to retrieve and update stock attributes, such as status and quantity.

Inventory

Allows you to retrieve and update the stock data.

Resource Name: cataloginventory_stock_item

Aliases:

Methods:

Faults

Fault Code Fault Message
101 Product not exists.
102 Product inventory not updated. Details in error message.

Examples

Change manage_stock setting to ‘off’ in the inventory area.

$attributeSets = $client->call($session, ‘product_stock.update’, array(’SKU’,array(’manage_stock’=>'0’,’use_config_manage_stock’=>'0’)));

The use_config_manage_stock unchecks the ‘Use Config Settings’ box which allows you to make changes to this product and not to use the global settings that are set by default.

Example 1. Working with stock update
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

// Get stock info
var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));

// Update stock info
$proxy->call($sessionId, 'product_stock.update', array('Sku', array('qty'=>50, 'is_in_stock'=>1)));

var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));
Example 2. Listing multiple SKUs' data
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
$sid = $client->login('apiUser', 'apiKey');

print_r(
    $client->call(
        $sid,
        'product_stock.list',
        array(
            array( // Notice the nested array
                'sku1',
                'sku2',
                'sku3',
                ...
                'skuN'
            )
        )
    )
);
Create the Magento file system owner