How to disable products in Magento2 which dont have any gallery image?
Products without a picture show up on category pages and in search results with Magento’s grey placeholder image, which looks unfinished. After a big import there can be hundreds of them, and disabling them one by one in the admin isn’t practical. This query disables every product that has no image in its gallery, in one go. Before you run it Back up the database. The query changes the status of many products at once and there’s no undo. Check which products will be affected first. The part inside the brackets, from SELECT to IS NULL, is a complete query on its own. Run it by itself and you get the IDs of all products without a gallery image. Check the ID of the status attribute in your database (see below). 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 ...