How to remove empty attributes “N/A” in Magento 2?

旧时模样 提交于 2019-12-08 05:38:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!