I have created tons of products without setting the weight. Now I would like to add the weight, same weight to all products. Can a sql query help me? Is there some other solution.


Take a look @ How to update product weight and Country of Manufacture using mysql query in Magento

#1. First get weight attribute_id value (assume 80)
SELECT attribute_id FROM eav_attribute where attribute_code = 'weight';

#2. To view all products weight attribute to see if they all are empty
#SELECT * FROM catalog_product_entity_decimal where attribute_id = 80;

#3. To update with new weight
Update catalog_product_entity_decimal as cped 
   set cped.value = [your new weight here] 
   where attribute_id = 80; # <- replace 80 with attribute_id from eav_attribute

Always back-up your database before making major changes

You could combine sql statement 1 and 3 see mysql update join

Update catalog_product_entity_decimal cped
   join eav_attribute ev ON ev.attribute_id = cped.attribute_id 
   Set cped.value = 1 #<- change to your weight
   where ev.attribute_code = 'weight';
  • 1
    when migrating from an old mage1x that used grams in the DB: Update catalog_product_entity_decimal as cped set cped.value = cped.value / 1000 where attribute_id = 80; – DM8 Feb 5 '18 at 11:10

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.