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.
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.
Use below, it worked for me:
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$product = $block->getProduct();
echo $_attributeValue = $product->getResource()->getAttribute('your_attribute')->getFrontend()->getValue($product);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($product_id);
$product->getCustomAttributeCode();`