Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Module: Mage_Catalog

Resource: catalog_product

Aliases:

  • product
Method:
  • catalog_product.update (SOAP V1)
  • catalogProductUpdate (SOAP V2)

Allows you to update the required product. Note that you should specify only those parameters which you want to be updated.

Aliases:

  • product.update

Note:

Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).

Arguments:

TypeNameDescription
stringsessionIdSession ID
stringproduct\productIdProduct ID
arrayproductDataArray of catalogProductCreateEntity
stringstoreViewStore view ID or code (optional)
stringidentifierTypeDefines whether the product ID or SKU is passed in the ‘product’ parameter

Returns:

TypeDescription
booleanTrue if the product is updated

The catalogProductCreateEntity content is as follows:

TypeNameDescription
ArrayOfStringcategoriesArray of categories
ArrayOfStringwebsitesArray of websites
stringnameProduct name
stringdescriptionProduct description
stringshort_descriptionProduct short description
stringweightProduct weight
stringstatusProduct status
stringurl_keyA relative URL path that can be entered in place of the target path
stringurl_pathURL path
stringvisibilityProduct visibility on the frontend
ArrayOfStringcategory_idsArray of category IDs
ArrayOfStringwebsite_idsArray of website IDs
stringhas_optionsDefines whether the product has options
stringgift_message_availableDefines whether the gift message is available for the product
stringpriceProduct price
stringspecial_priceProduct special price
stringspecial_from_dateDate starting from which the special price will be applied to the product
stringspecial_to_dateDate till which the special price will be applied to the product
stringtax_class_idTax class ID
arraytier_priceArray of catalogProductTierPriceEntity
stringmeta_titleMeta title
stringmeta_keywordMeta keyword
stringmeta_descriptionMeta description
stringcustom_designCustom design
stringcustom_layout_updateCustom layout update
stringoptions_containerOptions container
associativeArrayadditional_attributesArray of catalogProductAdditionalAttributesEntity
arraystock_dataArray of catalogInventoryStockItemUpdateEntity

Notes: The “websites” and “website_ids” or “categories” and “category_ids” parameters are interchangeable. In other words, you can specify an array of website IDs (int) and then you don’t need to specify the array of website codes (string) and vice versa.

The catalogProductTierPriceEntity content is as follows:

TypeNameDescription
stringcustomer_group_idCustomer group ID
stringwebsiteWebsite
intqtyQuantity of items to which the price will be applied
doublepricePrice that each item will cost

The catalogInventoryStockItemUpdateEntity content is as follows:

TypeNameDescription
stringqtyQuantity of items
intis_in_stockDefines whether the item is in stock
intmanage_stockManage stock
intuse_config_manage_stockUse config manage stock
intmin_qtyMinimum quantity for items to be in stock
intuse_config_min_qtyUse config settings flag (value defined in the Inventory System Configuration)
intmin_sale_qtyMinimum quantity allowed in the shopping cart
intuse_config_min_sale_qtyUse config settings flag
intmax_sale_qtyMaximum quantity allowed in the shopping cart
intuse_config_max_sale_qtyUse config settings flag
intis_qty_decimalDefines whether the quantity is decimal
intbackordersBackorders status
intuse_config_backordersUse config settings flag (for backorders)
intnotify_stock_qtyStock quantity below which a notification will appear
intuse_config_notify_stock_qtyUse config settings flag (for stock quantity)

The catalogProductAdditionalAttributesEntity content is as follows:

TypeName
associativeMultiArraymulti_data
associativeArraysingle_data

Single Data: array of attributes with only single value
Multi Data: array of attributes which could contain several values

Faults:

Fault CodeFault Message
100Requested store view not found.
101Product not exists.
102Invalid data given. Details in error message.

Examples

Request Example SOAP V1
$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If some stuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$result = $client->call($session, 'catalog_product.update', array('product_sku', array(
    'categories' => array(2),
    'websites' => array(1),
    'name' => 'Product name new 2',
    'description' => 'Product description',
    'short_description' => 'Product short description',
    'weight' => '10',
    'status' => '1',
    'url_key' => 'product-url-key',
    'url_path' => 'product-url-path',
    'visibility' => '4',
    'price' => '100',
    'tax_class_id' => 1,
    'meta_title' => 'Product meta title',
    'meta_keyword' => 'Product meta keyword',
    'meta_description' => 'Product meta description'
)));

var_dump ($result);
Request Example SOAP V2
$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

// If some stuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$result = $client->catalogProductUpdate($session, 'product_sku', array(
    'categories' => array(2),
    'websites' => array(1),
    'name' => 'Product name new',
    'description' => 'Product description',
    'short_description' => 'Product short description',
    'weight' => '10',
    'status' => '1',
    'url_key' => 'product-url-key',
    'url_path' => 'product-url-path',
    'visibility' => '4',
    'price' => '100',
    'tax_class_id' => 1,
    'meta_title' => 'Product meta title',
    'meta_keyword' => 'Product meta keyword',
    'meta_description' => 'Product meta description'
));

var_dump ($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));

$result = $proxy->catalogProductUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1',
'productData' => ((object)array(
    'name' => 'Product name updated',
    'status' => '1',
))));

var_dump($result->result);