I am using an object manager to get the attribute value even though it's not recommended. I am getting NULL in product-object which causing error "GetattributeText() on NULL". Below is the code that so far I tried
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); echo gettype($product); $slot_break = $product->getAttributeText('choose_slot_break');
when I echo gettype it shows "NULLObject". I have done so much googling before posting this question and have already tried almost all the solutions in the Magento stack exchange
The above code-sniffer is working well to show the value in a PHTML but here I am trying to get this inside a function which I needed for some calculation which is in a programmatically created dropdown attribute class which extends "\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource ". Pardon me if this ain't met the qualification to ask as a question.