0

HI How can I get MOQ of product by using object manager?

1 Answer 1

1

Try this code :-

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productStockObj = $objectManager->get('Magento\CatalogInventory\Api\StockRegistryInterface')->getStockItem($productId);
//print_r($productStockObj->getMinQty());
print_r($productStockObj->getData());

You will get the output like below format

Array
(
 [item_id] => 111
 [product_id] => 100
 [stock_id] => 1
 [qty] => 1000.0000
 [min_qty] => 10.0000
 [use_config_min_qty] => 0
 [is_qty_decimal] => 0
 [backorders] => 0
 [use_config_backorders] => 1
 [min_sale_qty] => 1.0000
 [use_config_min_sale_qty] => 1
 [max_sale_qty] => 0.0000
 [use_config_max_sale_qty] => 1
 [is_in_stock] => 1
 [low_stock_date] => 
 [notify_stock_qty] => 
 [use_config_notify_stock_qty] => 1
 [manage_stock] => 1
 [use_config_manage_stock] => 1
 [stock_status_changed_auto] => 0
 [use_config_qty_increments] => 1
 [qty_increments] => 0.0000
 [use_config_enable_qty_inc] => 1
 [enable_qty_increments] => 0
 [is_decimal_divided] => 0
 [website_id] => 1
 [deferred_stock_update] => 0
 [use_config_deferred_stock_update] => 1
 [type_id] => simple
)

Hope this helps you

Thanks ...

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.