How to Get Product Status in Magento 2

That’s all!
Thank You.
Or, while generating different types of reports in the Magento 2 store, one may only want to get the data of the enabled products. To implement such a solution, one may need to get product status in Magento 2.
Feel free to share the solution with Magento Community via social media.
Magento 2 storefront displays products that are enabled from the backend to the store visitors.
Apart from whether to display the product to visitors or not, there are other tasks where you need product status.
Magento 2 product status has two different states:

  • Enabled: The product is visible or enabled in the frontend.
  • Disabled: The product is not visible or disabled in the frontend.

Something went wrong.

Method to Get Product Status in Magento 2

If the product is enabled, it returns 1 and if the product is disabled, it returns 2.
If you have any doubts regarding this post, just mention them in the Comments section below.
In order to get product status programmatically in Magento 2, use the below method:
The product status is the current status of a particular product.
Before doing any product-related task, we have to check whether the product is enabled or not in the frontend. To do so, we need to get product status in Magento 2.
Thank you for subscribing.

Get Weekly Updates

For instance, while sending data to a third-party API, it requires sending only enabled products’ data and exclude the disabled products.

Never miss Magento tips, tricks, tutorials, and news.
I would be happy to help.

/**/

/*.mfp-bg{background:#000000d4}
/*]]>*/

/*.mfp-bg.mfp-ready{opacity:.6}
/*]]>*/

(based on 0 Reviews)