Magento 2 is shocking. I can’t even point out how many bugs make our life so much harder than it should be. But, I want to share a issue I had with weight and virtual products and how I fixed it.


The weight field was missing on my Back-End when editing or  creation products. So, once you saved the product they were becoming virtual ones.

Took me a long time to figure it out, but, eventually, I realised the mapping for a couple of fields (Weight, Has_Weight and Tax) got lost. You can use the queries below to fix them.

select * from eav_attribute where attribute_code = 'weight';
select * from eav_attribute where attribute_code = 'weight_type';
select * from eav_attribute where attribute_code = 'tax_class_id';

# check how the attributes look like
select * from catalog_eav_attribute where attribute_id = (select attribute_id from eav_attribute where attribute_code = 'weight');
select * from catalog_eav_attribute where attribute_id = (select attribute_id from eav_attribute where attribute_code = 'weight_type');
select * from catalog_eav_attribute where attribute_id = (select attribute_id from eav_attribute where attribute_code = 'tax_class_id');

# restore the fields on the back-end
update catalog_eav_attribute set apply_to = 'simple,virtual,downloadable,configurable,bundle'
where attribute_id = (select attribute_id from eav_attribute where attribute_code = 'weight');

update catalog_eav_attribute set apply_to = 'bundle'
where attribute_id = (select attribute_id from eav_attribute where attribute_code = 'weight_type');

update catalog_eav_attribute set apply_to = 'simple,virtual,downloadable,configurable,bundle'
where attribute_id = (select attribute_id from eav_attribute where attribute_code = 'tax_class_id');

# Populate simple products with a default weight
REPLACE INTO catalog_product_entity_decimal
SELECT null, 79, 0, entity_id, '1.100'
FROM catalog_product_entity
WHERE type_id = 'simple';[\code]

I hope it helps!

Magento 2 Missing Weight field and Wrong Virtual Producthttps://i2.wp.com/blog.mdnsolutions.com/wp-content/uploads/2016/06/Screen-Shot-2016-06-24-at-10.47.27-AM.png?fit=645%2C307&ssl=1https://i2.wp.com/blog.mdnsolutions.com/wp-content/uploads/2016/06/Screen-Shot-2016-06-24-at-10.47.27-AM.png?resize=150%2C150&ssl=1Renato MedinaMagentoMagento 2Has_Weight,Magento 2,Missing field,SImple,Tax,Virtual,WeightMagento 2 is shocking. I can't even point out how many bugs make our life so much harder than it should be. But, I want to share a issue I had with weight and virtual products and how I fixed it. The weight field was missing on my Back-End when editing...A Magento Craftsman in Melbourne