E:\wamp\www\Magento221\app\code\Hjtplus\Testa\etc\di.xml
<type name="Magento\Catalog\Block\Product\View\Attributes"> <plugin name="Hjtplus-Testa-Plugin-Attributes" type="Hjtplus\Testa\Plugin\Attributes" sortOrder="50"/> </type>
Hjtplus\Testa\Plugin\Attributes
class Attributes{
public function afterGetAdditionalData(\Magento\Catalog\Block\Product\View\Attributes $subject, $result) {
foreach ($result as $item){ if($item['value']=="N/A"){ unset($result[$item['code']]); } }
return $result;
}
public function aroundGetAdditionalData(\Magento\Catalog\Block\Product\View\Attributes $subject, callable $proceed,array $excludeAttr = []) { $result = $proceed($excludeAttr); if(count($result)>0){ foreach ($result as $item){ if($item['value']=="N/A"){ unset($result[$item['code']]); } } } return $result; }
}