Magento – Magento SOAP v1 – updating product by SKU

magento-1.9productsoap

I want to update product by it's SKU. I've found that it is possible to do with following code:

$client->call($sessionId, 'catalog_product.update', array($product_sku, array(
            'stock' => $stock)), null, 'SKU');

And… it doesn't work.

What am I doing wrong ?

Best Answer

According to the documentation you cannot pass the SKU as an argument of catalog_product.update:

http://devdocs.magento.com/guides/m1x/api/soap/catalog/catalogProduct/catalog_product.update.html

I suggest you use the catalog_product.info which accepts the SKU as an argument to retrieve the product ID then use the catalog_product.update function with the product ID you retrieved :

http://devdocs.magento.com/guides/m1x/api/soap/catalog/catalogProduct/catalog_product.info.html

Related Topic