Magento 2.0.x Problem product attributes Type Yes/No, not showing on front (Boolean product attributes)


If product has boolean attribute, this attribute is not visible on product page view.

We don't have the best solution but for the time being it works in one of our Magento 2.07 projects. We rewrote a function in : vendor\magento\module-catalog\Block\Product\View\Attributes.php to


 
 public function getAdditionalData(array $excludeAttr = ['media_gallery'])
    {
        $data = [];
          $product = $this->getProduct();
        $attributes = $product->getAttributes();

        foreach ($attributes as $attribute) {
    
     
            if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
                $value =  str_replace('"',"",json_encode($attribute->getFrontend()->getValue($product)));//$attribute->getFrontend()->getValue($product);
                if ($value == '' or $value == 'null'){
                    $value = -1;
                    
                }

                    
            
                if (!$product->hasData($attribute->getAttributeCode())) {
                    $value = __('N/A');
                } elseif ((string)$value == '') {
                    $value = __('No');
                } elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
                    $value = $this->priceCurrency->convertAndFormat($value);
                }

                if (is_string($value) && strlen($value)) {
                    $data[$attribute->getAttributeCode()] = [
                        'label' => __($attribute->getStoreLabel()),
                        'value' => $value,
                        'code' => $attribute->getAttributeCode(),
                    ];
                }
            }
        }
   
        return $data;
    }
}