These are the stocks I have


On my export this is what i'm getting, as you can see (for re and re_pro which belong to the same website) the quantity is fine , but the salable qty is a merge of both; that's why i'm trying to get back to the real quantity

default,3421,1,1.0000,,"Container",,"Default Stock : 1"
source_bl,3421,1,0.0000,,"Container",,"Stock BL : 0"
source_gf,3421,1,0.0000,,"Container",,"Stock GF : 0"
source_re,3421,1,1000.0000,,"Container",,"Stock RE : 1500"
source_sx,3421,1,0.0000,,"Container",,"Stock SX : 0"
source_yt,3421,1,1000.0000,,"Container",,"Stock YT : 1000"
source_re_pro,3421,1,500.0000,,"Container",,"Stock RE : 1500"

This wrong merged quantities is loaded by a custom GetSalableQuantityDataBySku that extends \Magento\InventorySalesAdminUi\Model\GetSalableQuantityDataBySku

And i'm trying to make that either an sql request to fix this quantity issue or to fix the custom method, sadly, I haven't succeeded to get the real quantities on my own.

For the full vision of the issue this is what I have on the custom class

public function execute(string $sku): array
    $stockInfo = [];
    $stockIds = $this->getAssignedStockIdsBySku->execute($sku);
    if (count($stockIds)) {
        foreach ($stockIds as $stockId) {
            $stockId = (int)$stockId;
            $stock = $this->stockRepository->get($stockId);
            $stockItemConfiguration = $this->getStockItemConfiguration->execute($sku, $stockId);
            $isManageStock = $stockItemConfiguration->isManageStock();

            $salesChannelCodes = [];
            foreach($stock->getExtensionAttributes()->getSalesChannels() as $salesChannel) {
                $salesChannelCodes[] = $salesChannel->getCode();

            $stockInfo[] = [
                'sales_channel_codes' => $salesChannelCodes,
                'stock_name' => $stock->getName(),
                'qty' => $isManageStock ? $this->getProductSalableQty->execute($sku, $stockId) : null,
                'manage_stock' => $isManageStock,
    return $stockInfo;

Thanks for your assistance !

2 Answers 2


My stock were configured by website instead of store, so the source_re and the source_re_pro had the same assigned stock id. Then, creating new stocks and sales channel made the trick.


You can export store stock too insted of export product

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.