Magento: Attributes aren’t being included in request

If your Magento attributes such a shipperhq_shipping_group, ship_length, ship_width, ship_height etc aren’t being picked up and included in the ShipperHQ request there’s a couple of reasons:

Use Parent

If you have a configurable or bundled product where the child item has the desired attributes that are not being picked up you’ll need to deselect “Use Parent” in the website configuration section. This will use the child product’s attributes, rather than the parent product’s attributes.

Indexes

If your indexes are out of date the attribute value will either not be picked up at all, or will be incorrect.

Magento 1
Refresh indexes under System->Index Management

Magento 2
Use the command line to run the following from the Magento root directory:
php bin/magento indexer:reindex

Configuration Scope

Check that the attribute in question isn’t set incorrectly in a different configuration scope. E.g set correctly at Default Configuration Scope/All Store Views, but set incorrectly in another configuration scope. You can choose the configuration scope using the drop down at the top left of your admin panel.

Attribute values in multiple tables

This can sometimes happen after a product import or if you’ve migrated from Magento 1 to 2. You need to remove / migrate the attribute values that are in the incorrect table into the correct table.

For example: shipperhq_shipping_group value should be stored in the database table catalog_product_entity_varchar on Magento 1 or catalog_product_entity_text on Magento 2. Sometimes values are stored in the wrong table. This will cause Magento to silently error and no values at all will return for the attribute. It’s possible that values will be stored in one of the other catalog_product_entity tables also so it’s worth checking those too.

This is some SQL you can run to resolve the issue above. You need to backup your database before you run this and should understand what it’s doing. Run at your own risk.

Magento 1

SELECT @attribute_id:=attribute_id FROM eav_attribute WHERE attribute_code='shipperhq_shipping_group';
INSERT into catalog_product_entity_varchar (entity_type_id, attribute_id, store_id, entity_id, value)
    SELECT entity_type_id, attribute_id, store_id, entity_id, value
    FROM catalog_product_entity_text
    WHERE attribute_id = @attribute_id ;

DELETE FROM catalog_product_entity_text WHERE attribute_id = @attribute_id;

Magento 2

shipperhq_shipping_group and shipperhq_warehouse should be of type text. Check in eav_attribute that this is the case before making the below changes.

SELECT @attribute_id:=attribute_id FROM eav_attribute WHERE attribute_code='shipperhq_shipping_group';
INSERT into catalog_product_entity_text (attribute_id, store_id, entity_id, value)
    SELECT attribute_id, store_id, entity_id, value
    FROM catalog_product_entity_varchar
    WHERE attribute_id = @attribute_id ;

DELETE FROM catalog_product_entity_varchar WHERE attribute_id = @attribute_id;