1

I'm trying to use Magento soap catalogInventoryStockRegistryV1UpdateStockItemBySku, but I cannot understand how parameters should be passed. I know there is REST documentation but if I apply the REST array of parameters to the soap call, it doesn't work.

So my question is: How can the catalogInventoryStockRegistryV1UpdateStockItemBySku api be used with soap? Alternatively, how can I update stock via soap?

1
  • Did you find solution? – MageDev Mar 5 at 6:55
0

I have found solution. Please see below my code change as per your need.

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

require('vendor/zendframework/zend-server/src/Client.php');
require('vendor/zendframework/zend-soap/src/Client.php');
require('vendor/zendframework/zend-soap/src/Client/Common.php');

$catalogProductRepositoryUrl = '<<your site url>>/soap/default?wsdl&services=catalogInventoryStockRegistryV1';
$token = '6n69tlvlu1pr5orjfkutgs817pw7eskp';

$options['stream_context'] = stream_context_create([
    'http' => [
        'header' => sprintf('Authorization: Bearer %s', $token)
    ]
]);

$soapClient = new SoapClient($catalogProductRepositoryUrl, $options);
$qtyData = [
    'qty' => 70,
    'isInStock' => 1,
    'isQtyDecimal' => 0,
    'showDefaultNotificationMessage' => 0,
    'useConfigMinQty' => 0,
    'minQty' => 2,
    'useConfigMinSaleQty' => 1,
    'minSaleQty' => 1,
    'useConfigMaxSaleQty' => 0,
    'maxSaleQty' => 10,
    'useConfigBackorders'  => 0,
    'backorders' => 1,
    'useConfigNotifyStockQty' => 0,
    'notifyStockQty' => 10,
    'useConfigQtyIncrements' => 1,
    'qtyIncrements' => 1,
    'useConfigEnableQtyInc' => 1,
    'enableQtyIncrements' => 1,
    'useConfigManageStock' => 1,
    'manageStock' => 1,
    'lowStockDate' => 1,
    'isDecimalDivided' => 1,
    'stockStatusChangedAuto' => 1
];

$response = $soapClient->catalogInventoryStockRegistryV1UpdateStockItemBySku(['productSku'=> 'F291', 'stockItem' => $qtyData]);
$result = $response->result;


echo '<pre>';print_r($result);exit;

?>

It's working fine. Still you have any query let me.

1
  • How to use this request in postman? getting err <faultstring>Procedure 'catalogInventoryStockRegistryV1UpdateStockItemBySku' not present</faultstring> – MageDev Mar 5 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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