cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I get an attribute into shopping cart price rules?

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Why can't I get an attribute into shopping cart price rules?

I would like to add my attribute weight as a shopping cart price rule. I have it set as Use for Promo Rule Conditions and have reindexed. Is there another step I am missing?

4 REPLIES 4

Re: Why can't I get an attribute into shopping cart price rules?

I'm wondering how to use attributes in promos too. 

Re: Why can't I get an attribute into shopping cart price rules?

Hello.

Weight (to be exact 'Total weight') is available in 'Conditions' tab by default - magento rules condition magento rules condition

Store Manager for Magento 1.x and 2.x - inventory management tool to automatically update products, customers, orders, and other data across multiple sales channels and suppliers.

Re: Why can't I get an attribute into shopping cart price rules?

But I don't need total weight, I need item weight.

Re: Why can't I get an attribute into shopping cart price rules?

You can add them pretty easy by selecting the attribute and changing this to yes- Use for Promo Rule Conditions

 

The problem is you can't do that with weight. 

 

I found this-

 

 

I don't know if this is a bug or a feature, but it seams like you cannot use the weight attribute for the rule conditions and actions.
When checking if an attribute is valid for rules this method is calledMage_Catalog_Model_Resource_Eav_Attribute::isAllowedForRuleCondition

public function isAllowedForRuleCondition()
{    $allowedInputTypes = array('text', 'multiselect', 'textarea', 'date', 'datetime', 'select', 'boolean', 'price');
    return $this->getIsVisible() && in_array($this->getFrontendInput(), $allowedInputTypes);
}

This seams reasonable. Now the strange part.
The weight attribute has the frontend input weight.
You can see this by running this query on the db.

SELECT * FROM eav_attribute where attribute_code = 'weight'. 

Changing the frontend_input to text makes the attribute available in promo rules. But I can't tell you if this is a good idea or not.

 

The problem is I am not a big fan of modifying core code, plus I am not sure if it would break something else.