1

How to Update Product Saleable qty using programmatically with Magento standard code ?

i am able to update product quantity using below code -

protected $_stockRegistry;
public function __construct(
    \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
)
{
    $this->_stockRegistry = $stockRegistry;
    parent::__construct();
}

public function customMethod() {
    $sku = 'xyz';
    $qty = 10;
    $stockItem = $this->_stockRegistry->getStockItemBySku($sku);
    $stockItem->setQty($qty);
    $this->_stockRegistry->updateStockItemBySku($sku, $stockItem);
}

using this code I am able to update product quantity but I need to update saleable quantity instead of product quantity

Your Answer

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

Browse other questions tagged or ask your own question.