0

I have created Attribute on category level enter image description here

now I want to fetch the value of this attribute. I have tried below code

 $_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $object_manager =
 $_objectManager->create('Magento\Catalog\Model\Category')->load($cat_id);
 echo "<pre>"; print_r($object_manager->getData('google_taxonomy'));

but not result coming.

1 Answer 1

0

Try the below solution,

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $category = $objectManager->get('Magento\Framework\Registry')->registry('current_category'); //Get Current Category
    $PCategory = $objectManager->get('Magento\Catalog\Model\CategoryFactory')->create()->load($category->getId());
    
    echo $PCategory->getGoogleTaxonomy();

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.