I have $product->setData('phone_features', $avidee); Now i want to check whether phone_feature value set or not.How can i check in magento 2.

2 Answers 2


If you have $product object already you can check your value by using this code:




In block :

public function getCatalogSession()
    return $this->catalogSession;

Then set attribute value in template :

$phoneFeature = $this->getCatalogSession()->getPhoneFeatures();

echo $phoneFeature; // hello

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.