1

I have 3 stocks, each having its own source. Every source is assigned to some or the other product.

When an order is placed with one of these products, how do I find out the source for each product in the order.

I tried using the method-

$orderItem->getProduct()->getQuantityAndStockStatus()

returns

{ ["is_in_stock"]=> bool(false) ["qty"]=> float(0) } 

However,

$orderItem->getProduct()->isInStock()

returns

true

Any ideas would be appreciated. Thanks!

1 Answer 1

1

The way how you are getting a product stock status is deprecated, as you are trying to retrieve multiple sources via the CatalogInventory APIs which are single stock by their nature. Instead, you supposed to use the API brought by new inventory:

Read the Inventory documentation for more details - https://github.com/magento-engcom/msi/wiki/Overview

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.