I have been able to SQL query my products that have weight in Magento 2

select * from catalog_product_entity_decimal where attribute_id=80 and value is not null

However, when I try to look up products without weight "value is null" I get none. Is there a way to look up which products don't have weight added to them via SQL or admin panel?

  • you means get product collection without weight using sql query??? – Mohit Patel May 26 at 20:33

NULL is case sensitive. The correct SQL query for getting attribute_id=80 and value is NULL would be:

select * from catalog_product_entity_decimal where attribute_id=80 and value is NULL;

Please note that the attribute_id will differ between Magento installations and can be found with:

SELECT * FROM eav_attribute where attribute_code LIKE '%weight%';

This will not give you what you want as the attribute_id will not exist in the catalog_product_entity_decimal-table if the product is not having a weight set.

One easy way to get products without weight is through the admin-panel.

  1. Go into your product-catalog, through Catalog ==> Products.
  2. Press on Columns (cog-wheel icon, on the top left corner of the product table).
  3. Select to show weight and sort on the weight-column.
| improve this answer | |
  • Precisely. The answer I was after. Thank you. – Alen Giliana May 27 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.