How can I get Magento 2 product’s status. e.g I would like to check if the Magento 2 product is disabled or not
Need to load Magento 2 product first and then call getStatus method to retrieve the status info of the Magento 2 product
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productRepositoryInterface = $objectManager->get('\Magento\Catalog\Api\ProductRepositoryInterface'); $product = $productRepositoryInterface->getById($productId); $status = $product->getStatus();