TransWikia.com

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

Magento Asked on December 9, 2021

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(
    MagentoCatalogInventoryApiStockRegistryInterface $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

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP