I tried below code works for single product quantity update in one soap api request but I want to update multi products stock quantities using only one request.

I tried multiple sku in array but not work

$client = new SoapClient('http://example.com/index.php/api/soap/?wsdl');    
 $session = $client->login('xxxxx', 'xxxxx');
echo "<pre>";
$sku = 'product1';
$stockItemData = array(
    'qty' => '22'

$result = $client->call(

1 Answer 1


finally I found a solution

$client = new SoapClient('http://example.com/index.php/api/soap/?wsdl');    
$session = $client->login('xxxx', 'xxxxx');

 // $productInfo is array which contains all product sku and its quantities which will update to another server 

 $productInfo = array( 

$start = microtime(true);
foreach($productInfo as $product )
    $calls[] = array('product_stock.update', array($product['sku'], array('qty'=>$product['qty'])));

  /* 2 products will go in one request to another server for product   update   stock data(in my case quantities) using SOAP API multiCall method 
 IF YOU HAVE LOTS OF PRODUCT FOR UPDATE TO ANOTHER SERVER THEN YOU CAN REPLACE VALUE IN array_chunk function(in my case 2) 2 is total products data

 foreach(array_chunk($calls, 2) as $skuChunk)
     $result = $client->multiCall($session, $skuChunk);
  echo $time_elapsed_secs = microtime(true) - $start; // How many times will be elapsed for this operation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.