1

In Magento2.3

I'm using http://localhost/new-jk/rest/V1/inventory/source-items

it is working fine for all stores but only default is not updating properly

The service is updating quantity of product but the salable quantity does not change only for default stock.

can someone face this issue? please guide

1
  • By seeing you query it looks like default might be removed from stores list somehow, Can you please check store listing API and check all available stores. Commented Apr 24, 2019 at 12:34

3 Answers 3

1

By seeing you query it looks like default might be removed from stores list somehow, Can you please check store listing API and check all available stores

 <host>/rest/<store_code>/V1/inventory/source-items

But if you haven't configure any stores then pass default

 <host>/rest/all/V1/inventory/source-items

For all store you need to pass website_id in post parameters

And to fetch all store data using API

storeStoreRepositoryV1


Group repository interface

http://magento.host/index.php/rest/V1/store/storeGroups
  • method : GET
  • Authorization : Bearer <admin token>

This will return website_id, root_category_id, default_store_id, name, code


0

You can simply indicate to your endpoint that you are fetching data from default store.
It should look like below:

http://localhost/new-jk/rest/default/V1/inventory/source-items
2
  • i am executing this with curl functions and using passing this array in json format $body = json_encode(['sourceItems' =>[ ['source_code' => $stock['source'], 'sku' => $data['sku'], 'quantity'=>$data['stock'], 'status'=> $product_status] ]]);
    – Alam Zaib
    Commented Apr 24, 2019 at 12:10
  • it is working fine for other store but the salable quantity in default stock not updating
    – Alam Zaib
    Commented Apr 24, 2019 at 12:11
0

Please follow the below steps to update the product inventory for the default stock.

Step 1: https://domain.com/rest/V1/inventory/source-items

Use Method : Post

Step 2: Send parameters in the api body:

{ "sourceItems": [{ "sku": "testseller", "source_code": "default", "quantity": 200, "status": 1 }] }

Step 3: Send the admin token in the API header.

Using this you will update the inventory for each stock.

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.