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
-
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.Aditya Shah– Aditya Shah2019年04月24日 12:34:49 +00:00Commented Apr 24, 2019 at 12:34
3 Answers 3
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 : GETAuthorization : Bearer <admin token>
This will return website_id, root_category_id, default_store_id, name, code
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
-
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– Alam Zaib2019年04月24日 12:10:58 +00:00Commented Apr 24, 2019 at 12:10
-
it is working fine for other store but the salable quantity in default stock not updatingAlam Zaib– Alam Zaib2019年04月24日 12:11:58 +00:00Commented Apr 24, 2019 at 12:11
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.