Fix Magento Attributes That Are Not Included in Requests

Overview

This article details resolution steps for when attributes are not included in requests from Magento.

If your Magento attributes (such as shipperhq_shipping_group, ship_length, ship_width, ship_height, etc.) aren’t being picked up and included in the ShipperHQ request please try the following steps one at a time in the order presented until your issue is resolved.

Steps

1. Check Website Configuration

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 change will cause Magento to submit the child product’s attributes, rather than the parent product’s attributes.

2. Refresh Indexes

If your indexes are out of date the attribute value will either not be picked up at all, or will be incorrect. Please try one of the following to correct this (depending on your Magento version):

  • For Magento 1 – Refresh indexes under System -> Index Management
  • For Magento 2 – Use the command line to run the following from the Magento root directory:
    php bin/magento indexer:reindex

3. Check All Configuration Scopes

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.

4. Check for Attribute Values in Multiple Tables

Sometimes, attributes can be left out of requests after a product import or if you’ve migrated from Magento 1 to 2. This can be due to values being stored in the wrong table. This will cause Magento to silently error and no values at all will return for the attribute. In this case, the attribute values will need to be moved to 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.

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.

To resolve this issue, you can run the following SQL commands:

Backup your database before attempting. If you are unsure what you are doing, seek assistance.
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;

For the dimensional shipping attributes (ship_height, ship_width and ship_length) these values are stored as decimal but may have been incorrectly stored in the varchar table.

INSERT INTO catalog_product_entity_decimal (entity_type_id,attribute_id,store_id,entity_id,value)
SELECT entity_type_id,attribute_id,store_id,entity_id,CAST(value as DECIMAL(12,4))
FROM catalog_product_entity_varchar
WHERE attribute_id in (SELECT attribute_id FROM eav_attribute WHERE attribute_code IN ('ship_height','ship_width','ship_length'));

DELETE FROM catalog_product_entity_varchar WHERE attribute_id in (SELECT attribute_id FROM eav_attribute WHERE attribute_code IN ('ship_height','ship_width','ship_length'));

Magento 2 Open Source

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;

Magento 2 Commerce

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, row_id, value)
    SELECT attribute_id, store_id, row_id, value
    FROM catalog_product_entity_varchar
    WHERE attribute_id = @attribute_id ;

DELETE FROM catalog_product_entity_varchar WHERE attribute_id = @attribute_id;

5. If You Still Have This Issue

If you have tried all of the above and your attributes are still not being passed in Magento’s request, please contact ShipperHQ Support:
512.522.4282
support@shipperhq.com

The first thing we will do will be to check that you have tried the steps described in this document.

Was this doc helpful?