How To Get Magento 2 Product’s Status

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();
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments