VPS business hosting starting at $29.95/24/7 premium technical support

How to disable products in Magento2 which dont have any gallery image?

UPDATE `catalog_product_entity_int` SET `value`=2 where `entity_id` in (SELECT a.`entity_id` FROM `catalog_product_entity` AS a LEFT JOIN `catalog_product_entity_media_gallery_value` AS b ON a.entity_id = b.entity_id LEFT JOIN `catalog_product_entity_media_gallery` AS c ON b.value_id = c.value_id WHERE c.value IS NULL) and `attribute_id` = 96

It is SQL query

Assumption:

value=2 means disable and value=1 means enable

attribute_id=96 means “status” attribute

References:

https://gist.github.com/tegansnyder/8464261#gistcomment-2910808

https://magento.stackexchange.com/a/83033/32283

Author: Harshvardhan Malpani

PHP Developer based in New Delhi, India. Working as a freelance web developer providing server deployment, website development and maintenance services.

Leave a Reply

Your email address will not be published. Required fields are marked *