Pregunta

How to get product attribute value in magento 2.0.6 product view page and list page

¿Fue útil?

Solución

In product view page you can get like this:

$this->getProduct()->getId();
$this->getProduct()->getName();

You can get custom attribute like this:

$attribute = $this->getProduct()->getResource()->getAttribute('attribute_id');
if ($attribute)
{
    $brick_value = $attribute->getFrontend()->getValue($this->getProduct());
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top