问题
I am using Magento 2 with Porto theme, I recently updated theme and magento now in product information I am also seeing empty attributes that are unrelated to the current products as N/A . how can I hide them?
I saw people discussing here this in Magento 1. but it doesn't work for 2.0.
please help if you know how to do it. thanks
回答1:
Magento_Catalog/templates/product/view/attributes.phtml
if(strpos($_data['value'],"N/A")===false):?>
<tr>
<th class="col label" scope="row"><?php echo $block->escapeHtml(__($_data['label'])) ?></th>
<td class="col data" data-th="<?php echo $block->escapeHtml(__($_data['label'])) ?>"><?php /* @escapeNotVerified */ echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>
<?php
endif;
来源:https://stackoverflow.com/questions/44665119/how-to-remove-empty-attributes-n-a-in-magento-2