Skip to main content
added 15 characters in body
Source Link

You need to change your way to get product attributes in phtml: you can get attributes using getAttr($_item->getProductId()); ?><?php $attributes = $block->getAttr($_item->getProductId()); ?> and after that you need to change function defined in block as:

public function getAttr($id) {

public function getAttr($id)
{
     $product = $this->productFactory->create()->load($id);
     return $product;
}

}

Now you can get all attributes in below way:

echo $attributes->getName();
echo $attributes->getPrice();

echo $attributes->getName();

echo $attributes->getPrice();

In this way you can get any other custom attribute's value.

In this way you can get any other custom attribute's value.

Hope this was helpful.

You need to change your way to get product attributes in phtml: you can get attributes using getAttr($_item->getProductId()); ?> and after that you need to change function defined in block as:

public function getAttr($id) {

    $product = $this->productFactory->create()->load($id);
    return $product;

}

Now you can get all attributes in below way:

echo $attributes->getName();

echo $attributes->getPrice();

In this way you can get any other custom attribute's value.

Hope this was helpful.

You need to change your way to get product attributes in phtml: you can get attributes using <?php $attributes = $block->getAttr($_item->getProductId()); ?> and after that you need to change function defined in block as:

public function getAttr($id)
{
     $product = $this->productFactory->create()->load($id);
     return $product;
}

Now you can get all attributes in below way:

echo $attributes->getName();
echo $attributes->getPrice();

In this way you can get any other custom attribute's value.

Hope this was helpful.

Source Link
kusum
  • 81
  • 3

You need to change your way to get product attributes in phtml: you can get attributes using getAttr($_item->getProductId()); ?> and after that you need to change function defined in block as:

public function getAttr($id) {

    $product = $this->productFactory->create()->load($id);
    return $product;

}

Now you can get all attributes in below way:

echo $attributes->getName();

echo $attributes->getPrice();

In this way you can get any other custom attribute's value.

Hope this was helpful.