I followed the Magento documentation regarding fetching Product Salable quantity using REST API.
https://devdocs.magento.com/guides/v2.3/rest/modules/inventory/check-salable-quantity.html
But I'm getting only 0 value for all products when I use get-product-salable-quantity API.
Can anyone help with this ASAP?
1 Answer 1
To check product salable quantity you can use this endpoint:
/V1/stockItems/{productSku}
or
/V1/stockStatuses/{productSku}
method GET
more magento 2 endpoints here https://devdocs.magento.com/swagger/
especially catalogInventoryStockRegistryV1 group
-
Thanks I can able to get stock statuses of products. Can you help me in getting the same salable quantity and max_sale_qty values for the product programmatically ?Quasar M– Quasar M2019年03月20日 10:53:29 +00:00Commented Mar 20, 2019 at 10:53
-
If You want to use api, just call that endpoints i meant ealier.lama377– lama3772019年03月21日 14:51:14 +00:00Commented Mar 21, 2019 at 14:51
-
and take what You need from product object. salable quantity is under data['quantity_and_stock_status']['qty'] Tell me if this solve your problems. Unfortunatelly I don't know what You mean about max_sale_qtylama377– lama3772019年03月21日 15:01:57 +00:00Commented Mar 21, 2019 at 15:01
-
protected $_productloader; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\ProductFactory $_productloader ) { $this->_productloader = $_productloader; parent::__construct($context); } public function getLoadProduct($id) { return $this->_productloader->create()->load($id); }lama377– lama3772019年03月21日 15:02:13 +00:00Commented Mar 21, 2019 at 15:02
-
Thanks I got all the required stock datas using the above API, but except one. Can you also help me in getting "Source Item Status", explained below. With the above API we can only get the stock statuses of current store or source. In Magento 2.3 we use MSI, I have two sources(source1 and source2). I need to fetch the "Source Item Status" of both the Sources programmatically or using API. Can you please help me with that ?Quasar M– Quasar M2019年03月21日 15:10:38 +00:00Commented Mar 21, 2019 at 15:10
Explore related questions
See similar questions with these tags.