I create an observer to intercept when a product is added to cart. The event that i used is "salesrule_validator_process".
The problem is that i create an eav attribute, but i can't get the value of that attribute related with the observable product. Here is my code:
public function execute( Observer $observer ) {
$item_attribute = $observer->getItem()->getProduct()->getResource()->getAttribute('discount_elegible')
->getData();
}
Which retrieve something like these:
[attribute_id] => 139 [entity_type_id] => 4 [attribute_code] => club_discount_elegible [attribute_model] => Magento\Catalog\Model\ResourceModel\Eav\Attribute [backend_model] => Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend [backend_type] => int
And continue...