I made this:
global $product;
$koostis = $product->get_attribute( 'color' );
echo "<h2>Color: ".$koostis."</h2>";
This show a color attribute on my product.
But if a product don't have a color attribute this script show only: "Color:" of course.
I try to use:
if (isset($koostis)) {
echo "<h2>Color: ".$koostis."</h2>";
}
But don't work because the variable is not exactly empty, i need a method to hide echo "<h2>Color: ".$koostis."</h2>"; if the variable not contain data.
Exist?