For some of our configured products (unfortunately), the PRODUCT_HAS_WEIGHT
attribute has not been set to 1
. Although, the products all have weight set (as a float), Magento still refuses to provide shipping calculation for these products.
I want to modify the PRODUCT_HAS_WEIGHT
property for all products in the database. For that I want to access the MySQL database and issue a query that updates all the corresponding fields. Unfortunately, I was unsuccessful in identifying the attribute to update.
For example, to examine the weights, I would do the following:
USE database
SELECT * FROM eav_attribute where attribute_code LIKE '%weight%'
SELECT * FROM catalog_product_entity_decimal where attribute_id = 82
In a similar fashion as in line (2), product has weight
is not found.
I'd kindly ask the community, to help me find the related attribute to update for each product.
I'm using Magento CE 2.1.6.
Best Answer
The attribute is not stored, is only use for meta purposes by the repo and it is basically a wrapper for the weight attribute within the method
customizeWeightField()
of classCatalog/Ui/DataProvider/Product/Form/Modifier/General.php
Modifying the product_has_weight you will change the product type; it defaults to
'Virtual'
but it will get converted to"Download"
if it has downloadable data, remember that 'has' is a magic method prefix, althoughhasWeight
is overridden on product types virtual and downloadable for the purpose of locking down afalse
Boolean value. The value is not specifically stored, the state will remain in the form of the product type, see theTypeTransitionManager
class and the pluginMagento\Downloadable\Model\Product\TypeTransitionManager\Plugin\Downloadable
, on configurable products it will be determined by the sum of the children state specified by the meta modifier.