How can I fetch custom product attribute value such as size when it's added to the cart?
I want to show the size selected in an add to cart popup (which contains all product details)!
Any help will be appreciated.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityHow can I fetch custom product attribute value such as size when it's added to the cart?
I want to show the size selected in an add to cart popup (which contains all product details)!
Any help will be appreciated.
Use below, it worked for me:
$_helper = $this->helper('Magento\Catalog\Helper\Output');
echo $_attributeValue = $block->getProduct()->getResource()->getAttribute('your_attribute')->getFrontend()->getValue($block->getProduct());
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($product_id);
$product->getCustomAttributeCode();`